Skip to content

Commit

Permalink
PNP: use DEVICE_ATTR_RO macro
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Zhen Lei authored and Rafael J. Wysocki committed Jun 7, 2021
1 parent 5bb5cea commit 3935787
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/pnp/card.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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)
{
Expand Down

0 comments on commit 3935787

Please sign in to comment.