Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4177537ybc; Tue, 26 Nov 2019 05:09:52 -0800 (PST) X-Google-Smtp-Source: APXvYqy1iQKHrDSeck3gyBXmoC9GvE+UYpfnlcXSioqsJoqZkpowZYYGHUBfjZDCaZLvpZLH5RmL X-Received: by 2002:aa7:cf8b:: with SMTP id z11mr25234310edx.294.1574773792665; Tue, 26 Nov 2019 05:09:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574773792; cv=none; d=google.com; s=arc-20160816; b=BHxMeeEPG/sSTXB1JawHk0bseP5DwfEhsElS17pC8/6ZTqk5EyaBwXrDmsf2s6PKLF S97chhhQVyWplKXHfcEhO9m8UEDz/1To7j8ujP90/f3upoCcpkvs2r2Kk/cohTDNvCwy H0aCjdDXAxUj1xpnv3hXpSky7lm6pBCVplAZwA+MlK01a17XLv1/CAxtB/egHrSfQmud 3HRKoIWJYp3MFR79fhyZZFcrF5DL7o8YJWs5StHXCHM2d2dQlt33YJeXOTk1Ux9BQvjW amTLhMD1WkTtrT8QgzRm1jX//SseIL7QENAmYdv+BP4Qp+HJqRAczo7PhxBRC8Nop35A 0AYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=0r5dhUzwU4M2NxGysQzv4TYwJAMoZjhblRi3bWQKxMU=; b=MyjLiTp44KKR7Ru4ta13NoKrs5a5Qt2bajswoyKpQ5wp/xjwa6K7GDP5aHlj6G90n1 02+N31mGql5q7kqVNSFib5NvhdU8mDcwu01ciUuRnn/fJI1BBGXqfLAcgjRyal8gEwsD KECBVcJFAq7qYKla8JrEsgjnM2yd0aI+wFWy9GxPWxHcMeCpF5kYdB0HD70X4WAzeqmq IIl6pBzLl5ZeZAj+Y9NON3YbUUI/vf6kF8HcAtclX79byHeM7dcP9EfX5xUeotKC88Ho EQ7dJ2abaJ+xcV1kje/SRJ+4ehxCB+Pc/Eqob7Bq3C9/9X900LleAMGtCWBaZrvcRZo+ Hcxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=eLeEpl5K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s16si6828318eju.337.2019.11.26.05.09.22; Tue, 26 Nov 2019 05:09:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=eLeEpl5K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727638AbfKZM5j (ORCPT + 99 others); Tue, 26 Nov 2019 07:57:39 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:58740 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727209AbfKZM5i (ORCPT ); Tue, 26 Nov 2019 07:57:38 -0500 Received: from [192.168.0.20] (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DE8DD554; Tue, 26 Nov 2019 13:57:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1574773057; bh=J9SzQZZPDUF5VtY95t1tVID5XUuA7MYxXWRRT7k349g=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=eLeEpl5KayW23pUQb4nw2XYnussurEHLl2duq02gNZXpQfsbNhDJjIPTbbfKDHZ4l Xbjqw9kXSY2TQxJSvyNQj2rCMzk62Nq9LR0zvRGGpB8sBMW/hyOuXWxEpdaM7WGRtW brSEvVlObnrdkS12fInKUQr/dG52S+ti7l3seVuo= Subject: Re: [PATCH v2] i2c: core: Use DEVICE_ATTR_*() helper macros To: Geert Uytterhoeven , Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org References: <20191113152306.13968-1-geert+renesas@glider.be> From: Kieran Bingham Message-ID: <1abe3b18-2914-c2a6-ce41-169953d3579b@ideasonboard.com> Date: Tue, 26 Nov 2019 12:57:33 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191113152306.13968-1-geert+renesas@glider.be> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, On 13/11/2019 15:23, Geert Uytterhoeven wrote: > Convert the i2c core sysfs attributes from DEVICE_ATTR() to > DEVICE_ATTR_*(), to reduce boilerplate. > This requires renaming some functions. Seems a nice cleanup. > Although no suitable macro exists for the delete_device attribute, > rename i2c_sysfs_delete_device() to delete_device_store() for > consistency. > > Signed-off-by: Geert Uytterhoeven > Reviewed-by: Luca Ceresoli Reviewed-by: Kieran Bingham > --- > v2: > - s/DEVICE_ATTR_RW/DEVICE_ATTR_*/ in summary and description, > - Add Reviewed-by. > --- > drivers/i2c/i2c-core-base.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c > index 6a5183cffdfc3e82..c87bf5bcab3f1349 100644 > --- a/drivers/i2c/i2c-core-base.c > +++ b/drivers/i2c/i2c-core-base.c > @@ -449,15 +449,15 @@ static void i2c_client_dev_release(struct device *dev) > } > > static ssize_t > -show_name(struct device *dev, struct device_attribute *attr, char *buf) > +name_show(struct device *dev, struct device_attribute *attr, char *buf) > { > return sprintf(buf, "%s\n", dev->type == &i2c_client_type ? > to_i2c_client(dev)->name : to_i2c_adapter(dev)->name); > } > -static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); > +static DEVICE_ATTR_RO(name); > > static ssize_t > -show_modalias(struct device *dev, struct device_attribute *attr, char *buf) > +modalias_show(struct device *dev, struct device_attribute *attr, char *buf) > { > struct i2c_client *client = to_i2c_client(dev); > int len; > @@ -472,7 +472,7 @@ show_modalias(struct device *dev, struct device_attribute *attr, char *buf) > > return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name); > } > -static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); > +static DEVICE_ATTR_RO(modalias); > > static struct attribute *i2c_dev_attrs[] = { > &dev_attr_name.attr, > @@ -1039,8 +1039,8 @@ EXPORT_SYMBOL_GPL(i2c_adapter_depth); > * the user to provide incorrect parameters. > */ > static ssize_t > -i2c_sysfs_new_device(struct device *dev, struct device_attribute *attr, > - const char *buf, size_t count) > +new_device_store(struct device *dev, struct device_attribute *attr, > + const char *buf, size_t count) > { > struct i2c_adapter *adap = to_i2c_adapter(dev); > struct i2c_board_info info; > @@ -1095,7 +1095,7 @@ i2c_sysfs_new_device(struct device *dev, struct device_attribute *attr, > > return count; > } > -static DEVICE_ATTR(new_device, S_IWUSR, NULL, i2c_sysfs_new_device); > +static DEVICE_ATTR_WO(new_device); > > /* > * And of course let the users delete the devices they instantiated, if > @@ -1107,8 +1107,8 @@ static DEVICE_ATTR(new_device, S_IWUSR, NULL, i2c_sysfs_new_device); > * the user to delete the wrong device. > */ > static ssize_t > -i2c_sysfs_delete_device(struct device *dev, struct device_attribute *attr, > - const char *buf, size_t count) > +delete_device_store(struct device *dev, struct device_attribute *attr, > + const char *buf, size_t count) > { > struct i2c_adapter *adap = to_i2c_adapter(dev); > struct i2c_client *client, *next; > @@ -1151,7 +1151,7 @@ i2c_sysfs_delete_device(struct device *dev, struct device_attribute *attr, > return res; > } > static DEVICE_ATTR_IGNORE_LOCKDEP(delete_device, S_IWUSR, NULL, > - i2c_sysfs_delete_device); > + delete_device_store); > > static struct attribute *i2c_adapter_attrs[] = { > &dev_attr_name.attr, >