LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: Dwaipayan Ray <dwaipayanray1@gmail.com>
Cc: openipmi-developer@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, lukas.bulwahn@gmail.com
Subject: Re: [PATCH] char: ipmi: use DEVICE_ATTR helper macro
Date: Fri, 30 Jul 2021 18:33:45 -0500	[thread overview]
Message-ID: <20210730233345.GF3406@minyard.net> (raw)
In-Reply-To: <20210730062951.84876-1-dwaipayanray1@gmail.com>

On Fri, Jul 30, 2021 at 11:59:51AM +0530, Dwaipayan Ray wrote:
> Instead of open coding DEVICE_ATTR, use the helper macro
> DEVICE_ATTR_RO to replace DEVICE_ATTR with 0444 octal
> permissions.

Looks good, this is queued for the next release.

-corey

> 
> This was detected as a part of checkpatch evaluation
> investigating all reports of DEVICE_ATTR_RO warning
> type.
> 
> Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
> ---
>  drivers/char/ipmi/ipmi_si_intf.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
> index 62929a3e397e..1cbc6a6a3ef4 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -1605,7 +1605,7 @@ static ssize_t name##_show(struct device *dev,			\
>  									\
>  	return snprintf(buf, 10, "%u\n", smi_get_stat(smi_info, name));	\
>  }									\
> -static DEVICE_ATTR(name, 0444, name##_show, NULL)
> +static DEVICE_ATTR_RO(name)
>  
>  static ssize_t type_show(struct device *dev,
>  			 struct device_attribute *attr,
> @@ -1615,7 +1615,7 @@ static ssize_t type_show(struct device *dev,
>  
>  	return snprintf(buf, 10, "%s\n", si_to_str[smi_info->io.si_type]);
>  }
> -static DEVICE_ATTR(type, 0444, type_show, NULL);
> +static DEVICE_ATTR_RO(type);
>  
>  static ssize_t interrupts_enabled_show(struct device *dev,
>  				       struct device_attribute *attr,
> @@ -1626,8 +1626,7 @@ static ssize_t interrupts_enabled_show(struct device *dev,
>  
>  	return snprintf(buf, 10, "%d\n", enabled);
>  }
> -static DEVICE_ATTR(interrupts_enabled, 0444,
> -		   interrupts_enabled_show, NULL);
> +static DEVICE_ATTR_RO(interrupts_enabled);
>  
>  IPMI_SI_ATTR(short_timeouts);
>  IPMI_SI_ATTR(long_timeouts);
> @@ -1658,7 +1657,7 @@ static ssize_t params_show(struct device *dev,
>  			smi_info->io.irq,
>  			smi_info->io.slave_addr);
>  }
> -static DEVICE_ATTR(params, 0444, params_show, NULL);
> +static DEVICE_ATTR_RO(params);
>  
>  static struct attribute *ipmi_si_dev_attrs[] = {
>  	&dev_attr_type.attr,
> -- 
> 2.28.0
> 

      reply	other threads:[~2021-07-30 23:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30  6:29 Dwaipayan Ray
2021-07-30 23:33 ` Corey Minyard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210730233345.GF3406@minyard.net \
    --to=minyard@acm.org \
    --cc=dwaipayanray1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=openipmi-developer@lists.sourceforge.net \
    --subject='Re: [PATCH] char: ipmi: use DEVICE_ATTR helper macro' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).