Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp95050pxb; Mon, 18 Oct 2021 21:35:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjLv8+m+IoogrfQGONwMl7EFnaSabDFg82o2SUHqHHe7BWuwrSgrgNq9KXK1FQDRZBNAek X-Received: by 2002:a05:6402:40cf:: with SMTP id z15mr49706525edb.138.1634618143836; Mon, 18 Oct 2021 21:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634618143; cv=none; d=google.com; s=arc-20160816; b=TC4VJld5bNJ/JaH7TjlAXPvQ4VDGVGxrValH6Pp85vTeRHTTZScpPc6DcclyPqc7KH VQ3pETjnC8KHr6pZXqG15D4biqU+V4Psdn+Pvc8tQNmLulmoOKmHV0GqPkKhOZTiOAJt fwbZrkLQVF76uVBY/c+BEEIpeAi/C3vxK5W4DrRn2xAPU++33CHyEZyo5cD87dJaMsbH v2j5kX8ToSjDtJbIL/3MC3Uyu6LK9LPq1CmgXRW1foF9lyNrMNQEBQm6E0QBs/e1zYVO ySbXNHgJJpsP8bIyQDdFbVUaSC6zEbDIUOEGgALWztCRB672UxLlL+dBQ94F+dCcNGWD 19QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=9woJRJCdvTxyTHSeEiuDf/eJRUof627R7Fo3s9JH8WM=; b=ciQiTlyTZt4OJ4fG+CV73CWmydl3/Ya/3N2YTidW6WAAeUhE3fml18EkZ1XgQ0c+up wkvwqNc/bz+OeP0L+kA7XFT7uJkrMG/lu6D6VZ733HkQIUbwmiqsJKRRNLCDlivsl6Jr 5B2M9p1W5v8/GwdlghCjMwTqIY39DXF4DdscMaEw5ifz1nqxWyJmpZIQqKdA8ZjIPAPM zakbj6ZrDONSfqEVU8wGRNd++BwpeAHUIJZBs6fLc72sqNxBjgTXWH97ZgaU8S11DGl3 7QC1OXvJXJQjKT1YryLpKSXiBElZfYVfQfUaK5nXydqDePGr2gx5FSNRNNe1RnctYUQ8 oWbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b="Z0/p9NPG"; 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 s3si28029134edd.342.2021.10.18.21.34.44; Mon, 18 Oct 2021 21:35:43 -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=@mg.codeaurora.org header.s=smtp header.b="Z0/p9NPG"; 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 S229774AbhJSEdD (ORCPT + 99 others); Tue, 19 Oct 2021 00:33:03 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:52250 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbhJSEdC (ORCPT ); Tue, 19 Oct 2021 00:33:02 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1634617850; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=9woJRJCdvTxyTHSeEiuDf/eJRUof627R7Fo3s9JH8WM=; b=Z0/p9NPGIe2ezjSpcgBIljrV+1o0XcT7Lr3F/BZKhEY5AyQl+OUdYov2bgmqtQCh6DsJMXU1 c8q9o0qs1o67rJxupGFcVHPu61iaLPOCYUT2/z9TYnCE4LhZqbEiVumvDUZ0hwJpxj24e3/l XTITzIwyXAiFKW3MZaoxWB5oc5w= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 616e49f4321f24005125cffd (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 19 Oct 2021 04:30:44 GMT Sender: hemantk=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id F1B2EC43617; Tue, 19 Oct 2021 04:30:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.1.5] (cpe-76-176-73-171.san.res.rr.com [76.176.73.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: hemantk) by smtp.codeaurora.org (Postfix) with ESMTPSA id 75CC2C4338F; Tue, 19 Oct 2021 04:30:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 75CC2C4338F Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org Subject: Re: [PATCH 3/3] bus: mhi: replace snprintf in show functions with sysfs_emit To: Manivannan Sadhasivam , Greg KH Cc: Joe Perches , 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 References: <20211016065734.28802-1-manivannan.sadhasivam@linaro.org> <20211016065734.28802-4-manivannan.sadhasivam@linaro.org> <6ddc01b24b1c72f7e92174a037043b5cfffa3431.camel@perches.com> <20211016161531.GA4048@thinkpad> From: Hemant Kumar Message-ID: Date: Mon, 18 Oct 2021 21:30:41 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211016161531.GA4048@thinkpad> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/16/2021 9:15 AM, Manivannan Sadhasivam wrote: > 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. Mani, i dont know if any script being used by any user to parse "Serial Number". Thanks, Hemant > > Thanks, > Mani > >> thanks, >> >> greg k-h -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project