All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Zhen Lei <thunder.leizhen@huawei.com>
Cc: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	linux-acpi <linux-acpi@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] PNP: use DEVICE_ATTR_RO macro
Date: Mon, 7 Jun 2021 16:25:38 +0200	[thread overview]
Message-ID: <CAJZ5v0hNOOc5unkfbN6NHz4U4S8RzoQB2QJJTt3bLmW63zitUQ@mail.gmail.com> (raw)
In-Reply-To: <20210602081546.11170-1-thunder.leizhen@huawei.com>

On Wed, Jun 2, 2021 at 10:15 AM Zhen Lei <thunder.leizhen@huawei.com> wrote:
>
> Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes
> the code a bit shorter and easier to read.
>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  drivers/pnp/card.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
> index 2430c14f472d26a..d40ed8621571b0a 100644
> --- a/drivers/pnp/card.c
> +++ b/drivers/pnp/card.c
> @@ -181,8 +181,8 @@ struct pnp_card *pnp_alloc_card(struct pnp_protocol *protocol, int id, char *pnp
>         return card;
>  }
>
> -static ssize_t pnp_show_card_name(struct device *dmdev,
> -                                 struct device_attribute *attr, char *buf)
> +static ssize_t name_show(struct device *dmdev,
> +                        struct device_attribute *attr, char *buf)
>  {
>         char *str = buf;
>         struct pnp_card *card = to_pnp_card(dmdev);
> @@ -191,10 +191,10 @@ static ssize_t pnp_show_card_name(struct device *dmdev,
>         return (str - buf);
>  }
>
> -static DEVICE_ATTR(name, S_IRUGO, pnp_show_card_name, NULL);
> +static DEVICE_ATTR_RO(name);
>
> -static ssize_t pnp_show_card_ids(struct device *dmdev,
> -                                struct device_attribute *attr, char *buf)
> +static ssize_t card_id_show(struct device *dmdev,
> +                           struct device_attribute *attr, char *buf)
>  {
>         char *str = buf;
>         struct pnp_card *card = to_pnp_card(dmdev);
> @@ -207,7 +207,7 @@ static ssize_t pnp_show_card_ids(struct device *dmdev,
>         return (str - buf);
>  }
>
> -static DEVICE_ATTR(card_id, S_IRUGO, pnp_show_card_ids, NULL);
> +static DEVICE_ATTR_RO(card_id);
>
>  static int pnp_interface_attach_card(struct pnp_card *card)
>  {
> --

Applied as 5.14 material, thanks!

      reply	other threads:[~2021-06-07 14:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02  8:15 [PATCH 1/1] PNP: use DEVICE_ATTR_RO macro Zhen Lei
2021-06-07 14:25 ` Rafael J. Wysocki [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=CAJZ5v0hNOOc5unkfbN6NHz4U4S8RzoQB2QJJTt3bLmW63zitUQ@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=thunder.leizhen@huawei.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.