Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752606AbdLKJyj (ORCPT ); Mon, 11 Dec 2017 04:54:39 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:42746 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752048AbdLKJyg (ORCPT ); Mon, 11 Dec 2017 04:54:36 -0500 X-Google-Smtp-Source: AGs4zMbAYQj6r8XEq5V3fESNBUsw2DxLFtd6ke9aIZzQGz+647g7nb69a0ztYJGRDwAvBygm1yLI8w== Date: Mon, 11 Dec 2017 15:24:30 +0530 From: Aishwarya Pant To: Thomas Petazzoni , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: julia.lawall@lip6.fr Subject: [PATCH] staging: fbtft: replace __ATTR() with DEVICE_ATTR() Message-ID: <20171211095430.GA2158@mordor.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1834 Lines: 73 This is a clean-up patch which replaces the uses of raw __ATTR(...) macro with the more conventional DEVICE_ATTR(...) for defining device attributes. Done using coccinelle- @r@ identifier foo, n; @@ struct device_attribute foo = __ATTR(n, ...); @script:python p@ id; foo << r.foo; n << r.n; @@ // standardise the variable name to dev_attr_{name} coccinelle.id = "dev_attr_" + n @@ identifier r.foo; declarer name DEVICE_ATTR; @@ //change definition - struct device_attribute foo = __ATTR + DEVICE_ATTR (...); @depends on r@ identifier r.foo, p.id; @@ // replace usages everywhere - foo + id Signed-off-by: Aishwarya Pant --- drivers/staging/fbtft/fbtft-sysfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c index 712096659aa0..506d604d01bb 100644 --- a/drivers/staging/fbtft/fbtft-sysfs.c +++ b/drivers/staging/fbtft/fbtft-sysfs.c @@ -197,19 +197,18 @@ static ssize_t show_debug(struct device *device, return snprintf(buf, PAGE_SIZE, "%lu\n", par->debug); } -static struct device_attribute debug_device_attr = - __ATTR(debug, 0660, show_debug, store_debug); +static DEVICE_ATTR(debug, 0660, show_debug, store_debug); void fbtft_sysfs_init(struct fbtft_par *par) { - device_create_file(par->info->dev, &debug_device_attr); + device_create_file(par->info->dev, &dev_attr_debug); if (par->gamma.curves && par->fbtftops.set_gamma) device_create_file(par->info->dev, &gamma_device_attrs[0]); } void fbtft_sysfs_exit(struct fbtft_par *par) { - device_remove_file(par->info->dev, &debug_device_attr); + device_remove_file(par->info->dev, &dev_attr_debug); if (par->gamma.curves && par->fbtftops.set_gamma) device_remove_file(par->info->dev, &gamma_device_attrs[0]); } -- 2.15.1