[v2] coccinelle: device_attr_show: Adapt to the latest Documentation/filesystems/sysfs.rst
Message ID | 20240119062057.4026888-1-lizhijian@fujitsu.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-30808-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp823695dyb; Thu, 18 Jan 2024 22:21:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+RtGOwoOz2zQQ54KSQ+wYjZyCC/EOyGUmSKoF71v13btsl+5PeOpztnA1zM/A7QffpdRJ X-Received: by 2002:a05:620a:472c:b0:783:8bfa:9596 with SMTP id bs44-20020a05620a472c00b007838bfa9596mr79603qkb.102.1705645292583; Thu, 18 Jan 2024 22:21:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705645292; cv=pass; d=google.com; s=arc-20160816; b=Cf4dDqsUgV5jeAIo5Bm0MJ+xE04rOoUslbXnDwsZNKhStELamCzso+gk5DmY4Zqtrh lPu9DvU52VSrqegtvUXJ+KmYB8fBMsmVW1PKgEDt5mExIiUJZ5QmBQBq7SFm+0YDYa8t MILOGWAD6XzmQXYmCEm5nh/e9NSLSAzb7fRiVmeZwTGNO4fhDvcIG/qTHwcnG9tPtUqK ghYNxbASQf/KvIXvNjGUI97/CLXnhHJQNuOKw7JBXL/MBpt+iFmB5A8i1G1C1wWbBStV S7YDVAhIgNvACFDhLl/0PqOOFJXjDdtQBHpvolZ+WFzqeb7OMDwIEaRRk5M+Xi98t+ti vqzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=HK0EnkWoA29dqUqfBgOmizDiiBsLBH05UicuuS1m/D4=; fh=eObaU1ZuQTJtApCzShuZ6RdzTN8lxcJC0rVSUX7aGVU=; b=zthm31pmz7HpLI8zBY185Q0f0Z6ggtCMke/qwHc/Fiw0XdXNMol7nKw00LdOE3oLsE 2izvm5qzlmzi+PHlNJqWXW/d6/W6nWq+PZvTM2/8b12+1hNrFCApfOKyFHu0fJBsJwIV guJ8qk4Fmf5h36UF8jU2Ejj3RY3xAEmpVub/DjHDKsSP1kDvTIFuz6AJUmvS4PY9YpqX fYmcEZWEW0eapDxq0IrnDq+MnE9zF4NDEN03utuNWUXfzja4dJkXJ4G8VYLqlqw0o5qm rk5b1WIPhNeb1fqqY3DzTeUDjz0TQkJS0UVWLVRQ3b1YpM60HpffQz3yX344+2dfTxxj PqLQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=fujitsu.com dmarc=pass fromdomain=fujitsu.com); spf=pass (google.com: domain of linux-kernel+bounces-30808-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30808-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l16-20020a37f510000000b007837beed303si3102449qkk.617.2024.01.18.22.21.32 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 22:21:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30808-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=fujitsu.com dmarc=pass fromdomain=fujitsu.com); spf=pass (google.com: domain of linux-kernel+bounces-30808-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30808-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 538C71C22C7A for <ouuuleilei@gmail.com>; Fri, 19 Jan 2024 06:21:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CDB6DDA3; Fri, 19 Jan 2024 06:21:15 +0000 (UTC) Received: from esa6.hc1455-7.c3s2.iphmx.com (esa6.hc1455-7.c3s2.iphmx.com [68.232.139.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C56A4CA4A for <linux-kernel@vger.kernel.org>; Fri, 19 Jan 2024 06:21:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.139.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705645273; cv=none; b=CkpF20GcSPQ92eULSicbHrfljCXyKhB+B9NPjHmysBB6V6GerruGeazJyb780a/njRi1vLfa13vjUGN6ZnvARNjVscBrOS9CZJpSzF/hRJCfQoLmtvFwynOT7AQ046TZqUW5+DsXmqBi+agVFuXY+NWQ+vBMk8nRFKUnNZVXMvs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705645273; c=relaxed/simple; bh=2dXpWaC/gA+rQCGSdigv19bRkfr4cEkbCln5JNbcfiE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=mjZOJGdJ96nNG8HLWC+bnqbPU0FZyO/wliWX/cRpNsGbhgsG+N1sa1o8VsgZF5XWlQHEeCr/QVYlr352pnkWl0HCx6/VZx1KKd13gG9OYzdchWWT8+R5zhwsc/X+wblPfzw9nAo2kp2LGeCwvLG7YzRPBS+uxeXDVTbgXvq/p8I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fujitsu.com; spf=pass smtp.mailfrom=fujitsu.com; arc=none smtp.client-ip=68.232.139.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fujitsu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fujitsu.com X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="148292404" X-IronPort-AV: E=Sophos;i="6.05,204,1701097200"; d="scan'208";a="148292404" Received: from unknown (HELO oym-r3.gw.nic.fujitsu.com) ([210.162.30.91]) by esa6.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 15:21:07 +0900 Received: from oym-m4.gw.nic.fujitsu.com (oym-nat-oym-m4.gw.nic.fujitsu.com [192.168.87.61]) by oym-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id 0E961D64B1 for <linux-kernel@vger.kernel.org>; Fri, 19 Jan 2024 15:21:05 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by oym-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id 41F56AA47D for <linux-kernel@vger.kernel.org>; Fri, 19 Jan 2024 15:21:04 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id BF915200968EC for <linux-kernel@vger.kernel.org>; Fri, 19 Jan 2024 15:21:03 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 1946F1A015E; Fri, 19 Jan 2024 14:21:03 +0800 (CST) From: Li Zhijian <lizhijian@fujitsu.com> To: linux-kernel@vger.kernel.org Cc: Li Zhijian <lizhijian@fujitsu.com>, Julia Lawall <Julia.Lawall@inria.fr>, Nicolas Palix <nicolas.palix@imag.fr>, cocci@inria.fr Subject: [PATCH v2] coccinelle: device_attr_show: Adapt to the latest Documentation/filesystems/sysfs.rst Date: Fri, 19 Jan 2024 14:20:57 +0800 Message-Id: <20240119062057.4026888-1-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-28128.005 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-28128.005 X-TMASE-Result: 10--8.997200-10.000000 X-TMASE-MatchedRID: VFz6FHT9KvIRC3tpysE8AO9kW9mxCQvttOtXYgbXjde+f7ap9DJaDSxz RYsJiUav/17ljwcNaRm5hiunv4GcSziJuiRnf5DQKiJEqUFWRggFeeAjqMW+l8ZgSaBgziUc2d8 mtRIRsUMkfu0SYDUi3tk+AWND1SQ/1s1AHJ9E8eDfSQNpZkETVFLiJI6ntczPeGHkpR2WBaKp7E +IyeS1Xt9azz0zRbyE1mLuCemy7OOnhintEWTpJ65bb5QEYSkdLYdywTHl7nvZCDeKLir288tMy hlcs3zJTLP4m7if3GSdqC2fLtk9xB8TzIzimOwPC24oEZ6SpSkj80Za3RRg8JU8c6O2cgtdKkXm cQlIhgRkwIxiFgO1Jve1LKdTmTjePJuGM8tMGsU= X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788498718775166436 X-GMAIL-MSGID: 1788498718775166436 |
Series |
[v2] coccinelle: device_attr_show: Adapt to the latest Documentation/filesystems/sysfs.rst
|
|
Commit Message
Zhijian Li (Fujitsu)
Jan. 19, 2024, 6:20 a.m. UTC
Adapt description, warning message and MODE=patch according to the latest Documentation/filesystems/sysfs.rst: > show() should only use sysfs_emit() or sysfs_emit_at() when formatting > the value to be returned to user space. After this patch: When MODE=report, $ make coccicheck COCCI=scripts/coccinelle/api/device_attr_show.cocci M=drivers/hid/hid-picolcd_core.c MODE=report <...snip...> drivers/hid/hid-picolcd_core.c:304:8-16: WARNING: please use sysfs_emit or sysfs_emit_at drivers/hid/hid-picolcd_core.c:259:9-17: WARNING: please use sysfs_emit or sysfs_emit_at When MODE=patch, $ make coccicheck COCCI=scripts/coccinelle/api/device_attr_show.cocci M=drivers/hid/hid-picolcd_core.c MODE=patch <...snip...> diff -u -p a/drivers/hid/hid-picolcd_core.c b/drivers/hid/hid-picolcd_core.c --- a/drivers/hid/hid-picolcd_core.c +++ b/drivers/hid/hid-picolcd_core.c @@ -255,10 +255,12 @@ static ssize_t picolcd_operation_mode_sh { struct picolcd_data *data = dev_get_drvdata(dev); - if (data->status & PICOLCD_BOOTLOADER) - return snprintf(buf, PAGE_SIZE, "[bootloader] lcd\n"); - else - return snprintf(buf, PAGE_SIZE, "bootloader [lcd]\n"); + if (data->status & PICOLCD_BOOTLOADER) { + return sysfs_emit(buf, "[bootloader] lcd\n"); + } + else { + return sysfs_emit(buf, "bootloader [lcd]\n"); + } } static ssize_t picolcd_operation_mode_store(struct device *dev, @@ -301,7 +303,7 @@ static ssize_t picolcd_operation_mode_de { struct picolcd_data *data = dev_get_drvdata(dev); - return snprintf(buf, PAGE_SIZE, "hello world\n"); + return sysfs_emit(buf, "hello world\n"); } static ssize_t picolcd_operation_mode_delay_store(struct device *dev, CC: Julia Lawall <Julia.Lawall@inria.fr> CC: Nicolas Palix <nicolas.palix@imag.fr> CC: cocci@inria.fr Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> --- V2: - changed title from coccinelle: device_attr_show.cocci: update description and warning message - Fix MODE=patch - Extract patch from the patch set[1] so that maintainer can accept it separately. [1] https://lore.kernel.org/lkml/20240116041129.3937800-1-lizhijian@fujitsu.com/ --- scripts/coccinelle/api/device_attr_show.cocci | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-)
Comments
On Fri, 19 Jan 2024, Li Zhijian wrote: > Adapt description, warning message and MODE=patch according to the latest > Documentation/filesystems/sysfs.rst: > > show() should only use sysfs_emit() or sysfs_emit_at() when formatting > > the value to be returned to user space. > > After this patch: > When MODE=report, > $ make coccicheck COCCI=scripts/coccinelle/api/device_attr_show.cocci M=drivers/hid/hid-picolcd_core.c MODE=report > <...snip...> > drivers/hid/hid-picolcd_core.c:304:8-16: WARNING: please use sysfs_emit or sysfs_emit_at > drivers/hid/hid-picolcd_core.c:259:9-17: WARNING: please use sysfs_emit or sysfs_emit_at > > When MODE=patch, > $ make coccicheck COCCI=scripts/coccinelle/api/device_attr_show.cocci M=drivers/hid/hid-picolcd_core.c MODE=patch > <...snip...> > diff -u -p a/drivers/hid/hid-picolcd_core.c b/drivers/hid/hid-picolcd_core.c > --- a/drivers/hid/hid-picolcd_core.c > +++ b/drivers/hid/hid-picolcd_core.c > @@ -255,10 +255,12 @@ static ssize_t picolcd_operation_mode_sh > { > struct picolcd_data *data = dev_get_drvdata(dev); > > - if (data->status & PICOLCD_BOOTLOADER) > - return snprintf(buf, PAGE_SIZE, "[bootloader] lcd\n"); > - else > - return snprintf(buf, PAGE_SIZE, "bootloader [lcd]\n"); > + if (data->status & PICOLCD_BOOTLOADER) { > + return sysfs_emit(buf, "[bootloader] lcd\n"); > + } > + else { > + return sysfs_emit(buf, "bootloader [lcd]\n"); > + } > } > > static ssize_t picolcd_operation_mode_store(struct device *dev, > @@ -301,7 +303,7 @@ static ssize_t picolcd_operation_mode_de > { > struct picolcd_data *data = dev_get_drvdata(dev); > > - return snprintf(buf, PAGE_SIZE, "hello world\n"); > + return sysfs_emit(buf, "hello world\n"); > } > > static ssize_t picolcd_operation_mode_delay_store(struct device *dev, > > CC: Julia Lawall <Julia.Lawall@inria.fr> > CC: Nicolas Palix <nicolas.palix@imag.fr> > CC: cocci@inria.fr > Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> > --- > V2: > - changed title from coccinelle: device_attr_show.cocci: update description and warning message > - Fix MODE=patch > - Extract patch from the patch set[1] so that maintainer can accept it separately. Applied. I subsequently simplified the patch case to contain the following: - snprintf(BUF, SZ, FORMAT + sysfs_emit(BUF, FORMAT ,...); This also works for the case where there are only three arguments. It has the benefit that the change is recognized as a line replacement, so no extra {} are added when the call is in an if branch. julia > [1] https://lore.kernel.org/lkml/20240116041129.3937800-1-lizhijian@fujitsu.com/ > --- > scripts/coccinelle/api/device_attr_show.cocci | 22 +++++++++++-------- > 1 file changed, 13 insertions(+), 9 deletions(-) > > diff --git a/scripts/coccinelle/api/device_attr_show.cocci b/scripts/coccinelle/api/device_attr_show.cocci > index a28dc061653a..634514937e63 100644 > --- a/scripts/coccinelle/api/device_attr_show.cocci > +++ b/scripts/coccinelle/api/device_attr_show.cocci > @@ -1,10 +1,8 @@ > // SPDX-License-Identifier: GPL-2.0-only > /// > /// From Documentation/filesystems/sysfs.rst: > -/// show() must not use snprintf() when formatting the value to be > -/// returned to user space. If you can guarantee that an overflow > -/// will never happen you can use sprintf() otherwise you must use > -/// scnprintf(). > +/// show() should only use sysfs_emit() or sysfs_emit_at() when formatting > +/// the value to be returned to user space. > /// > // Confidence: High > // Copyright: (C) 2020 Denis Efremov ISPRAS > @@ -30,15 +28,21 @@ ssize_t show(struct device *dev, struct device_attribute *attr, char *buf) > > @rp depends on patch@ > identifier show, dev, attr, buf; > +expression BUF, SZ, FORMAT, STR; > @@ > > ssize_t show(struct device *dev, struct device_attribute *attr, char *buf) > { > <... > +( > return > -- snprintf > -+ scnprintf > - (...); > +- snprintf(BUF, SZ, FORMAT, STR); > ++ sysfs_emit(BUF, FORMAT, STR); > +| > + return > +- snprintf(BUF, SZ, STR); > ++ sysfs_emit(BUF, STR); > +) > ...> > } > > @@ -46,10 +50,10 @@ ssize_t show(struct device *dev, struct device_attribute *attr, char *buf) > p << r.p; > @@ > > -coccilib.report.print_report(p[0], "WARNING: use scnprintf or sprintf") > +coccilib.report.print_report(p[0], "WARNING: please use sysfs_emit or sysfs_emit_at") > > @script: python depends on org@ > p << r.p; > @@ > > -coccilib.org.print_todo(p[0], "WARNING: use scnprintf or sprintf") > +coccilib.org.print_todo(p[0], "WARNING: please use sysfs_emit or sysfs_emit_at") > -- > 2.29.2 > >
> I subsequently simplified the patch case to contain the following: > > - snprintf(BUF, SZ, FORMAT > + sysfs_emit(BUF, FORMAT > ,...); > > This also works for the case where there are only three arguments. > It has the benefit that the change is recognized as a line replacement, so > no extra {} are added when the call is in an if branch. Would you like to consider the application of the following SmPL code variant? -snprintf +sysfs_emit (BUF, - SZ, FORMAT, ... ); Regards, Markus
On Sun, 21 Jan 2024, Markus Elfring wrote: > > I subsequently simplified the patch case to contain the following: > > > > - snprintf(BUF, SZ, FORMAT > > + sysfs_emit(BUF, FORMAT > > ,...); > > > > This also works for the case where there are only three arguments. > > It has the benefit that the change is recognized as a line replacement, so > > no extra {} are added when the call is in an if branch. > > Would you like to consider the application of the following SmPL code variant? > > -snprintf > +sysfs_emit > (BUF, > - SZ, > FORMAT, > ... > ); It's ok too. julia > > Regards, > Markus >
>> Would you like to consider the application of the following SmPL code variant? >> >> -snprintf >> +sysfs_emit >> (BUF, >> - SZ, >> FORMAT, >> ... >> ); > > It's ok too. Are you going to integrate such a transformation approach? Regards, Markus
On Sun, 21 Jan 2024, Markus Elfring wrote: > >> Would you like to consider the application of the following SmPL code variant? > >> > >> -snprintf > >> +sysfs_emit > >> (BUF, > >> - SZ, > >> FORMAT, > >> ... > >> ); > > > > It's ok too. > > Are you going to integrate such a transformation approach? No. I already pushed the commit for Linux v6.8, and I don't think the change has any practical impact. julia
>>>> -snprintf >>>> +sysfs_emit >>>> (BUF, >>>> - SZ, >>>> FORMAT, >>>> ... >>>> ); >>> >>> It's ok too. >> >> Are you going to integrate such a transformation approach? > > No. This is a pity. > I already pushed the commit for Linux v6.8, I hope then that the change acceptance for the “beautification” and refinement of SmPL code can grow for subsequent versions. > and I don't think the change has any practical impact. I got an other development view for further fine-tuning possibilities. Regards, Markus
On 21/01/2024 05:20, Julia Lawall wrote: >> V2: >> - changed title from coccinelle: device_attr_show.cocci: update description and warning message >> - Fix MODE=patch >> - Extract patch from the patch set[1] so that maintainer can accept it separately. > Applied. > > I subsequently simplified the patch case to contain the following: > > - snprintf(BUF, SZ, FORMAT > + sysfs_emit(BUF, FORMAT > ,...); Great, that was what i want. But i didn't get the correct syntax. I wrote it wrongly: - snprintf(BUF, SZ, FORMAT, ...); + sysfs_emit(BUF, SZ, FORMAT, ...); > > This also works for the case where there are only three arguments. > It has the benefit that the change is recognized as a line replacement, so > no extra {} are added when the call is in an if branch.
>>> It's ok too. >> >> Are you going to integrate such a transformation approach? > > No. I already pushed the commit for Linux v6.8, I suggest to reconsider such a view together with the metavariable “STR” which became obsolete in the discussed SmPL script. > and I don't think the change has any practical impact. Can you ever get into the mood to increase the granularity of a source code change specification a bit more? Regards, Markus
diff --git a/scripts/coccinelle/api/device_attr_show.cocci b/scripts/coccinelle/api/device_attr_show.cocci index a28dc061653a..634514937e63 100644 --- a/scripts/coccinelle/api/device_attr_show.cocci +++ b/scripts/coccinelle/api/device_attr_show.cocci @@ -1,10 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only /// /// From Documentation/filesystems/sysfs.rst: -/// show() must not use snprintf() when formatting the value to be -/// returned to user space. If you can guarantee that an overflow -/// will never happen you can use sprintf() otherwise you must use -/// scnprintf(). +/// show() should only use sysfs_emit() or sysfs_emit_at() when formatting +/// the value to be returned to user space. /// // Confidence: High // Copyright: (C) 2020 Denis Efremov ISPRAS @@ -30,15 +28,21 @@ ssize_t show(struct device *dev, struct device_attribute *attr, char *buf) @rp depends on patch@ identifier show, dev, attr, buf; +expression BUF, SZ, FORMAT, STR; @@ ssize_t show(struct device *dev, struct device_attribute *attr, char *buf) { <... +( return -- snprintf -+ scnprintf - (...); +- snprintf(BUF, SZ, FORMAT, STR); ++ sysfs_emit(BUF, FORMAT, STR); +| + return +- snprintf(BUF, SZ, STR); ++ sysfs_emit(BUF, STR); +) ...> } @@ -46,10 +50,10 @@ ssize_t show(struct device *dev, struct device_attribute *attr, char *buf) p << r.p; @@ -coccilib.report.print_report(p[0], "WARNING: use scnprintf or sprintf") +coccilib.report.print_report(p[0], "WARNING: please use sysfs_emit or sysfs_emit_at") @script: python depends on org@ p << r.p; @@ -coccilib.org.print_todo(p[0], "WARNING: use scnprintf or sprintf") +coccilib.org.print_todo(p[0], "WARNING: please use sysfs_emit or sysfs_emit_at")