Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2616498pxb; Sun, 17 Oct 2021 20:37:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylak3WZcvRncZF4BBiHtac8bYObrhhUzwHa63oMlTp5e0eEt08+NZiEiDbXaoJWh8TRbnZ X-Received: by 2002:a63:4344:: with SMTP id q65mr21610673pga.450.1634528242381; Sun, 17 Oct 2021 20:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528242; cv=none; d=google.com; s=arc-20160816; b=HF20WbDMv4vOp9eWw5r4rv0p+XSCdUR9MFzWD/mlU/AMrQItQ3ACkJoqivrX/ztDHX KwmrnRcyt/k4i95T32NCzujwCoU0RojztRA3LA7uEIYOhv2uwjgPqY02HiZTEB464bL+ wvQFd+rQXoie3mZ0YPFKk24ExLEF+gBqnsJVaAknX6Oc2wmE4qzCZr6EW3X+Ee5BfBDs rU1PozQN/TMgtY1irlCfSpqtSHTcUXbr0nINyGuqKAmbUR2hKUlNeWME542awt07Pj/o EevPO3sTMHt/nmbDKBwm2KkHaYjITQaLQGmL5tgvVpPI/6lE1QbkZgw+i1z7uAYE9zkL 8Stw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=m8eUASbtDpCC/NLtt78aug/NML1cRIG1HliTG+amyXM=; b=bEvf7A6Ov1TyzLeMyDqEiH/4Dbu8WOaA3eHUrEDm4RlWfO3eX9+FnsMp9D1iUtFZL4 zhwOUUIVUv9cv0Xp8gsyqFHvEMpQPwvLdPeLES/vbIuxaYbQeE8VbJ/tCHJ8bNv/yhuj 33JRbpoWYXwAbepkbEfNotvr/2erJh0Qmfh/DnNS+jSQh69NOAxHU0fJvd4wAa7K2+VJ BlQSLpHk+sQn8+CJycs9Ai2/RT1bY+RRgvvwXy9KoHAIM0m4yQyZ8aGPy2/w6dZdPytR 7IB5WzSXqClbFpdFucBul6GNbOiVJxN/CIIXRuNsFOF4W4p3y16XyUGj5SmZKWQUIpDQ 6qcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H7xORHgR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id on12si3351544pjb.40.2021.10.17.20.37.10; Sun, 17 Oct 2021 20:37:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H7xORHgR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237070AbhJPPJW (ORCPT + 98 others); Sat, 16 Oct 2021 11:09:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:44182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233105AbhJPPJV (ORCPT ); Sat, 16 Oct 2021 11:09:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DA8AD60ED5; Sat, 16 Oct 2021 15:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634396833; bh=IIcR3vigEHlyG+m7wrxzuIMKNB+TXsX74NmOA7yY2Lc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H7xORHgRcyt8t9uvNTK5OU/QU8G+15ATpwFXYCtQ6YpGPlL/AyEZHJ4fyCoEO8JmD 6VKG5aUB9OdE6ixcTN2mFbCGNjTxmHONKxiTt3sW7ZGDBTzkN+eGYlOuPUCNmLpcmw Q9gSi8raSVpCmHPE7jRhoR4LRvKoOHPr3YBwlfjY= Date: Sat, 16 Oct 2021 17:07:06 +0200 From: Greg KH To: Joe Perches Cc: Manivannan Sadhasivam , hemantk@codeaurora.org, bbhatt@codeaurora.org, loic.poulain@linaro.org, wangqing@vivo.com, mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: Re: [PATCH 3/3] bus: mhi: replace snprintf in show functions with sysfs_emit Message-ID: References: <20211016065734.28802-1-manivannan.sadhasivam@linaro.org> <20211016065734.28802-4-manivannan.sadhasivam@linaro.org> <6ddc01b24b1c72f7e92174a037043b5cfffa3431.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6ddc01b24b1c72f7e92174a037043b5cfffa3431.camel@perches.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 16, 2021 at 03:24:17AM -0700, Joe Perches wrote: > On Sat, 2021-10-16 at 09:37 +0200, Greg KH wrote: > > On Sat, Oct 16, 2021 at 12:27:34PM +0530, Manivannan Sadhasivam wrote: > > > From: Qing Wang > > > coccicheck complains about the use of snprintf() in sysfs show functions. > [] > > > diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c > [] > > > @@ -94,7 +94,7 @@ static ssize_t serial_number_show(struct device *dev, > > > struct mhi_device *mhi_dev = to_mhi_device(dev); > > > struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl; > > > > > > - return snprintf(buf, PAGE_SIZE, "Serial Number: %u\n", > > > + return sysfs_emit(buf, "Serial Number: %u\n", > > > mhi_cntrl->serial_number); > > > > The text "Serial Number: " should not be in here, right? It's obvious > > this is a serial number, that's what the documentation and file name > > says. Userspace should not have to parse sysfs files. > > sysfs is ABI right? Parsing or not, it's what's already there. If no tools rely on this, and we can change it, we should at least try. We can not change ABI if something breaks. If nothing relies on it, then it is fine to do so. thanks, greg k-h