Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2616555pxb; Sun, 17 Oct 2021 20:37:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaFQPMjiY7O86UFHhl44ieAev/QWM9QA/wEBOr8Qb7jV5qedF97ZislhdyXJcHJ/0o+YgP X-Received: by 2002:a17:90b:350c:: with SMTP id ls12mr30778984pjb.36.1634528247967; Sun, 17 Oct 2021 20:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528247; cv=none; d=google.com; s=arc-20160816; b=c4VmI00/CRPZlJS5SpYh0zTC+UmERSQkp9yTN2lKDTHOucAZp0wSKCxSt6cvmk+gxD 2Z9kFMZIqbrnaOVE1kxIR7Vcd+r9XxClINg7m92kpt7/KYBjNGLUzItqwPWJhRAxWj0F 7KkIqrb0U+3mhC9nFL3G/v89XTWzuR0tYaE3UqayLmtn/Iwx0Uh1/k07sADxCWQr3i66 6oNnXHhAoXQ8S9Mu8Wv/7yQKE5SGHVNs6QmUX/yf+Socmq3O9wHaG6y7rmLrD3kRkV3j C7zbmeY66C+yi9r1WJL2Xt+pJgX2LxGKOFvM7hIqE93z0VdGiJgFxvUK2gfb6x5gnY8l 3x6w== 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=e7lrEFbOSmkz30gAOS7xYjD5/iC2fuyS3EI3L5vS+pc=; b=xnBY70vjQB/eeLTdfr5zpKo3x0B9NFGXuuYC8fOOCJxtfBgDeaEUejgsyJA7TxRGNO m9Ggbis27BCJZuKIE6et+NGpyfqLkZG1bQS7YL4Xv3HCer70Fj+DDYgu/LwIQjZAVIAV xx5pzBi/G0hGMEDQUkAaAKAeTWROC0bwT1IH/ZVXV2cZA7JC1qgjB/2OaWBrdpUETcVs +2FKRQ6EENkJ8FbJIIPLQ1QOT85cKWAxOQAj2NzkMqezedeXfDY0bkgqRrvOjr5cH9e3 8gt7J5osm5wqXWb/hABIHCvQbRIAZW0+CTFKQBVBI4FkbLoRJKcwJcOGY0TSqna0mlkD f6Uw== 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 x69si16775355pgd.176.2021.10.17.20.37.15; Sun, 17 Oct 2021 20:37:27 -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 S236894AbhJPPPP (ORCPT + 98 others); Sat, 16 Oct 2021 11:15:15 -0400 Received: from smtprelay0103.hostedemail.com ([216.40.44.103]:54282 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235703AbhJPPPO (ORCPT ); Sat, 16 Oct 2021 11:15:14 -0400 Received: from omf14.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id E02D01018D5AF; Sat, 16 Oct 2021 15:13:05 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf14.hostedemail.com (Postfix) with ESMTPA id 2F15D268E46; Sat, 16 Oct 2021 15:13:04 +0000 (UTC) Message-ID: <400d3fe720e336d5dba6e9b95c75baadf22a6a58.camel@perches.com> Subject: Re: [PATCH 3/3] bus: mhi: replace snprintf in show functions with sysfs_emit From: Joe Perches To: Greg KH , Linus Torvalds 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 Date: Sat, 16 Oct 2021 08:13:03 -0700 In-Reply-To: References: <20211016065734.28802-1-manivannan.sadhasivam@linaro.org> <20211016065734.28802-4-manivannan.sadhasivam@linaro.org> <6ddc01b24b1c72f7e92174a037043b5cfffa3431.camel@perches.com> 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.89 X-Stat-Signature: 9uhebz6odwgnyap79pzfzw94x7mhn8a1 X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: 2F15D268E46 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/lF+a3yNodCoxdxWj3to9HFbSG6J4S2Fs= X-HE-Tag: 1634397184-28310 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2021-10-16 at 17:07 +0200, Greg KH wrote: > 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. That's a quite bad way to think of an ABI. All that does is tempt fate as you don't know if something already uses it until someone complains and by that time something else may be written to depend on the new behavior.