Skip to content

Commit 3935787

Browse files
Zhen Leirafaeljw
authored andcommitted
PNP: use DEVICE_ATTR_RO macro
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 <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 5bb5cea commit 3935787

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/pnp/card.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ struct pnp_card *pnp_alloc_card(struct pnp_protocol *protocol, int id, char *pnp
181181
return card;
182182
}
183183

184-
static ssize_t pnp_show_card_name(struct device *dmdev,
185-
struct device_attribute *attr, char *buf)
184+
static ssize_t name_show(struct device *dmdev,
185+
struct device_attribute *attr, char *buf)
186186
{
187187
char *str = buf;
188188
struct pnp_card *card = to_pnp_card(dmdev);
@@ -191,10 +191,10 @@ static ssize_t pnp_show_card_name(struct device *dmdev,
191191
return (str - buf);
192192
}
193193

194-
static DEVICE_ATTR(name, S_IRUGO, pnp_show_card_name, NULL);
194+
static DEVICE_ATTR_RO(name);
195195

196-
static ssize_t pnp_show_card_ids(struct device *dmdev,
197-
struct device_attribute *attr, char *buf)
196+
static ssize_t card_id_show(struct device *dmdev,
197+
struct device_attribute *attr, char *buf)
198198
{
199199
char *str = buf;
200200
struct pnp_card *card = to_pnp_card(dmdev);
@@ -207,7 +207,7 @@ static ssize_t pnp_show_card_ids(struct device *dmdev,
207207
return (str - buf);
208208
}
209209

210-
static DEVICE_ATTR(card_id, S_IRUGO, pnp_show_card_ids, NULL);
210+
static DEVICE_ATTR_RO(card_id);
211211

212212
static int pnp_interface_attach_card(struct pnp_card *card)
213213
{

0 commit comments

Comments
 (0)