Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2615014pxb; Sun, 17 Oct 2021 20:34:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTejSKl0zVHBc5UCm7x9Je3IslkWjaeHUN8oA2R/N/GkgCJYNiNnBdGHeF6InaEjWnK1Ir X-Received: by 2002:a62:31c5:0:b0:447:cd37:61f8 with SMTP id x188-20020a6231c5000000b00447cd3761f8mr26378668pfx.29.1634528085404; Sun, 17 Oct 2021 20:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528085; cv=none; d=google.com; s=arc-20160816; b=AJ6Tmq8Y6bNi2kDUfpGVcjH9DdJzhDoIYxI+xmc1FA4K6LcSCyuACPoElzVPsw8yyc Imge8A9sVWOtks7t7OWRVVsvUbBXh5LGY+TZ7RFdDUZlu17RI83LbNMa2fE8M7Oy7pWJ ecRjG1nWChbMQuhCPDGyR+0kaeHayVFYH+Dk4u4ofsTW2BgGvuhaZz2EagD5c6SfNJxY 9iJnBHZNwjQFvutXqAhllHT/pARISwPX3y2xszH8MwkiscQWnFtw+47wxfShEG/ys0Zt u6cliMVgH4PQZ2STRNSNcyep5ciJhJcahn4/KcOJImCvoPoAEoObpzQZrfJDElHdakOL DTCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=lDGypvnanpGldP0M48LU/vcHU6v4TrCKSI7HfmI7qrs=; b=yd13B78XvrLb2wnE1uMWfEX6iSiqrzpXqtvovNy+yxU+lNJGR9jZYLYIz1Vb1pwee2 SY1i3IPUaXTNOfGbsiYGLq7Ogf74LzRkJih/aLOAo2Wwlv1lYHsZK2jzM0lTH+cG1d2v h1rGlRbNWn0KvE+aS7cBdajhbrA/YqoFdmNKYWPoUc+AiFYEAOVyL1UmjWCymAhGBdMA R4gp8z/ObrJN79zZ6kG3UFzb5R1kXwl4wkvIQu2Amw3gsHmcbZdjU1DZl/keNq0lrGNm OchkRxkZPnd7m0PMDXL726IGmxz+q5vAb6fktjnhK4EssnWiUb91cDOeWS0jVRD+kfjr uzkw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o11si27081560pgu.41.2021.10.17.20.34.33; Sun, 17 Oct 2021 20:34:45 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240160AbhJPK03 (ORCPT + 98 others); Sat, 16 Oct 2021 06:26:29 -0400 Received: from smtprelay0029.hostedemail.com ([216.40.44.29]:36398 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235031AbhJPK02 (ORCPT ); Sat, 16 Oct 2021 06:26:28 -0400 Received: from omf19.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id 0B04439BA7; Sat, 16 Oct 2021 10:24:20 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA id 9523220D764; Sat, 16 Oct 2021 10:24:18 +0000 (UTC) Message-ID: <6ddc01b24b1c72f7e92174a037043b5cfffa3431.camel@perches.com> Subject: Re: [PATCH 3/3] bus: mhi: replace snprintf in show functions with sysfs_emit From: Joe Perches To: Greg KH , Manivannan Sadhasivam Cc: 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 Date: Sat, 16 Oct 2021 03:24:17 -0700 In-Reply-To: References: <20211016065734.28802-1-manivannan.sadhasivam@linaro.org> <20211016065734.28802-4-manivannan.sadhasivam@linaro.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.4-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.38 X-Stat-Signature: 91sxoiniyzum7wdgd7kangjd88gejuj5 X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: 9523220D764 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX18mqnsmvmciBIb4oKRgjUfrWQOVP9NORno= X-HE-Tag: 1634379858-169333 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.