Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2616955pxb; Sun, 17 Oct 2021 20:38:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpJcgs/nrz4RhVtsptO07XY+vQJAqrDhc1zZOd+3WBSi4gc6hsktqSfxIyh7hTOIgFhAR8 X-Received: by 2002:a65:6a4b:: with SMTP id o11mr20600843pgu.278.1634528297034; Sun, 17 Oct 2021 20:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528297; cv=none; d=google.com; s=arc-20160816; b=TEZp0re/O2XmV6FFcM+KZnVU6hHJwZEq+ZeFjOl0An6iRfP1R8GC76ITrYXhIO0TKu 6c6Cbp3l5NGqWoCtDyhEM4WgtiAb8JDs6pZmJc2Mub//vDM1gtF1fuWFaYjvd97SP0LM Afb3lB8XtMANFIpTP1Pv/92/h7XRsScPNo/8tJ7u2eNeSc+DypEP/LKz2k7Dk6cievWT V5IQnkWEU/90I/tEp688n/0DUpot6hUBST/3NFK9Vcpj41QsQsO3kP4N24kj2lT4lgvU MazDwEwVwuiuz+7J7FTMANwlVwalfhVqiorXPwreitd9ocgpuSsoljp8UKaJtqtLi8ae adPg== 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; bh=ZmdDaqsdFQFf5+8gMddwj2s08tJ9fGWGTfVoyGe4hn8=; b=W6ZLP3eSpN7yyDJF9NhtHHA4yazarLvPb9N4ara9CEGtJeraMTNUkcij+AUTjZAuLK VYLK7069UzcrXwIvczp10oFB1sTf1Xp6D8nfqiFLsl0mH5MATCBphnOJHPfxLTdwcoLM rrhpDEC88PmhNOPLpizYUfQ3MMGv7z97Vxro0IBP5ImPqyb+MlDBi4srKHn7ogJOgc23 LZg1KjP2HBLLrtBhiNt7m1PUFOUBaSSBvHuZDYHdNEtr/dRty1XGAW7MYpHlxJ+CM/Vq XO5Muz3VQ32VvwwNTxq5gdTYpet6dfsr/rm5o6xE1mVl+rs/48qTRkZgR6sjInnJuJ7o dzPA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si14704658pfc.213.2021.10.17.20.38.05; Sun, 17 Oct 2021 20:38:17 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240633AbhJPQRv (ORCPT + 98 others); Sat, 16 Oct 2021 12:17:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:41550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231197AbhJPQRs (ORCPT ); Sat, 16 Oct 2021 12:17:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C29C660F70; Sat, 16 Oct 2021 16:15:36 +0000 (UTC) Date: Sat, 16 Oct 2021 21:45:31 +0530 From: Manivannan Sadhasivam To: Greg KH Cc: Joe Perches , 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: <20211016161531.GA4048@thinkpad> 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 16, 2021 at 05:07:06PM +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. > Hemant, Bhaumik, do you guys know if there are any possible users (scripts/apps) of this ABI? I'm not 100% inclined to change it but if we are _sure_ that there are no users yet, then I'm ok with it. Thanks, Mani > thanks, > > greg k-h