From patchwork Sun Jan 7 09:36:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: venkat.prashanth2498@gmail.com X-Patchwork-Id: 10148145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F36CC6037E for ; Sun, 7 Jan 2018 09:36:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7E5D28912 for ; Sun, 7 Jan 2018 09:36:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAE5028893; Sun, 7 Jan 2018 09:36:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5316328893 for ; Sun, 7 Jan 2018 09:36:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752520AbeAGJgV (ORCPT ); Sun, 7 Jan 2018 04:36:21 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:38200 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752498AbeAGJgT (ORCPT ); Sun, 7 Jan 2018 04:36:19 -0500 Received: by mail-pf0-f195.google.com with SMTP id u25so4034182pfg.5 for ; Sun, 07 Jan 2018 01:36:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=BjpmUYQ/FsdBqn0QOLwKI9fMnwThEqMQ+QMfREw9KuI=; b=ReB5uchNRQVjo0pjm9E3CZoEwL7FjkkX0Hp828iDi4Kb3A7vjlfT+XAM1CdgqQCZZH DSaYs+Tsn43WbP9eIy3vhq5z+gK8U9C8yWDgbpF6DXHB3OkSOsy1anx4jU4Sxse1YXSC 2GzgJ2ymxHbMC4bNaa9TH3WCvVUBJUPzsnDHg3wQu2xar9LXw+CVvD5L+tw9DvSTL5Uz wL8dwOysWpqZzwiHNKM4WAGcX8ofTUFDsolsppGpfvHnm5xViGn5m33R2BBfue/Dnwf3 iFCbG/eT1bZ5p7BEZPQDw1ILzHjT0o5+e1LgwMQGVRB2sfMlablVMNvU2WM34AvNytaR dGzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BjpmUYQ/FsdBqn0QOLwKI9fMnwThEqMQ+QMfREw9KuI=; b=sgdzqpkgWSahrurbGDZDJJ4H2t8dhecqU2zS8bqW8ioWEnp2FV91RSLzcqSuR8v+h/ P16AZT8TWDRfgwoW16Qp3msr677x2Szz4xTFTgDlRwktz0adE8BEE7z2JvhwgqhKaj6H QdOqFbzkT1A5V9XwYAne6xzUfAzs6dcugCG3kzzlnjEiS1tFPj3gtnPBfz5uJ2ClMklv R/LhA90yq6o7Da74u6LXxbBieyDFCcVXgEdOJt54Wv1HPD+rQswHxTTv6wDUi2d1QxUs rUcrG1BDQOdQdlWrwiNPaPu6vQFzjbFh1aOc1ETuEkGyGr9Bz70Qqfu3TBrKDdel0Dt+ ih+Q== X-Gm-Message-State: AKGB3mIl2/FmfIlyK83KctHGX+ksa+huG2MJFiWkJ9Cd5w0ox90/MHPd hITub5u6Ji7xOMtpqnW/ZA4= X-Google-Smtp-Source: ACJfBovYAM4tZFTyYtLR+E9/RmZHuNIiz4s+SuGWOttiXx+kbidL6u0tEr1lVrzQzv4S7/zJUe0Nnw== X-Received: by 10.101.93.71 with SMTP id e7mr6951500pgt.342.1515317778972; Sun, 07 Jan 2018 01:36:18 -0800 (PST) Received: from localhost.localdomain ([117.209.168.231]) by smtp.gmail.com with ESMTPSA id e7sm22536603pfj.44.2018.01.07.01.36.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Jan 2018 01:36:18 -0800 (PST) From: venkat.prashanth2498@gmail.com To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org Cc: knaack.h@gmx.de, pmeerw@pmeerw.net, linux-iio@vger.kernel.org, Venkat Prashanth B U Subject: [PATCH] imu:adis16480: fix debugfs_simple_attr.cocci warnings Date: Sun, 7 Jan 2018 15:06:11 +0530 Message-Id: <1515317771-4499-1-git-send-email-venkat.prashanth2498@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Venkat Prashanth B U Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE for debugfs files. Semantic patch information: Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() imposes some significant overhead as compared to DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe(). Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci Signed-off-by: Venkat Prashanth B U --- drivers/iio/imu/adis16480.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c index 7a33d6b..8e9f31f 100644 --- a/drivers/iio/imu/adis16480.c +++ b/drivers/iio/imu/adis16480.c @@ -194,7 +194,7 @@ static int adis16480_show_serial_number(void *arg, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(adis16480_serial_number_fops, +DEFINE_DEBUGFS_ATTRIBUTE(adis16480_serial_number_fops, adis16480_show_serial_number, NULL, "0x%.4llx\n"); static int adis16480_show_product_id(void *arg, u64 *val) @@ -212,7 +212,7 @@ static int adis16480_show_product_id(void *arg, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(adis16480_product_id_fops, +DEFINE_DEBUGFS_ATTRIBUTE(adis16480_product_id_fops, adis16480_show_product_id, NULL, "%llu\n"); static int adis16480_show_flash_count(void *arg, u64 *val) @@ -230,24 +230,28 @@ static int adis16480_show_flash_count(void *arg, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(adis16480_flash_count_fops, +DEFINE_DEBUGFS_ATTRIBUTE(adis16480_flash_count_fops, adis16480_show_flash_count, NULL, "%lld\n"); static int adis16480_debugfs_init(struct iio_dev *indio_dev) { struct adis16480 *adis16480 = iio_priv(indio_dev); - debugfs_create_file("firmware_revision", 0400, + debugfs_create_file_unsafe("firmware_revision", 0400, indio_dev->debugfs_dentry, adis16480, &adis16480_firmware_revision_fops); - debugfs_create_file("firmware_date", 0400, indio_dev->debugfs_dentry, - adis16480, &adis16480_firmware_date_fops); - debugfs_create_file("serial_number", 0400, indio_dev->debugfs_dentry, - adis16480, &adis16480_serial_number_fops); - debugfs_create_file("product_id", 0400, indio_dev->debugfs_dentry, - adis16480, &adis16480_product_id_fops); - debugfs_create_file("flash_count", 0400, indio_dev->debugfs_dentry, - adis16480, &adis16480_flash_count_fops); + debugfs_create_file_unsafe("firmware_date", 0400, + indio_dev->debugfs_dentry, adis16480, + &adis16480_firmware_date_fops); + debugfs_create_file_unsafe("serial_number", 0400, + indio_dev->debugfs_dentry, adis16480, + &adis16480_serial_number_fops); + debugfs_create_file_unsafe("product_id", 0400, + indio_dev->debugfs_dentry, adis16480, + &adis16480_product_id_fops); + debugfs_create_file_unsafe("flash_count", 0400, + indio_dev->debugfs_dentry, adis16480, + &adis16480_flash_count_fops); return 0; }