Skip to content

Commit ba6857b

Browse files
committed
i2o: convert bus code to use dev_groups
The dev_attrs field of struct bus_type is going away soon, dev_groups should be used instead. This converts the i2o bus code to use the correct field. Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b785464 commit ba6857b

3 files changed

Lines changed: 23 additions & 13 deletions

File tree

‎drivers/message/i2o/core.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extern int __init i2o_pci_init(void);
3333
extern void __exit i2o_pci_exit(void);
3434

3535
/* device */
36-
extern struct device_attribute i2o_device_attrs[];
36+
extern const struct attribute_group *i2o_device_groups[];
3737

3838
extern void i2o_device_remove(struct i2o_device *);
3939
extern int i2o_device_parse_lct(struct i2o_controller *);

‎drivers/message/i2o/device.c‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,45 +138,55 @@ static void i2o_device_release(struct device *dev)
138138
}
139139

140140
/**
141-
* i2o_device_show_class_id - Displays class id of I2O device
141+
* class_id_show - Displays class id of I2O device
142142
* @dev: device of which the class id should be displayed
143143
* @attr: pointer to device attribute
144144
* @buf: buffer into which the class id should be printed
145145
*
146146
* Returns the number of bytes which are printed into the buffer.
147147
*/
148-
static ssize_t i2o_device_show_class_id(struct device *dev,
149-
struct device_attribute *attr,
150-
char *buf)
148+
static ssize_t class_id_show(struct device *dev, struct device_attribute *attr,
149+
char *buf)
151150
{
152151
struct i2o_device *i2o_dev = to_i2o_device(dev);
153152

154153
sprintf(buf, "0x%03x\n", i2o_dev->lct_data.class_id);
155154
return strlen(buf) + 1;
156155
}
156+
static DEVICE_ATTR_RO(class_id);
157157

158158
/**
159-
* i2o_device_show_tid - Displays TID of I2O device
159+
* tid_show - Displays TID of I2O device
160160
* @dev: device of which the TID should be displayed
161161
* @attr: pointer to device attribute
162162
* @buf: buffer into which the TID should be printed
163163
*
164164
* Returns the number of bytes which are printed into the buffer.
165165
*/
166-
static ssize_t i2o_device_show_tid(struct device *dev,
167-
struct device_attribute *attr, char *buf)
166+
static ssize_t tid_show(struct device *dev, struct device_attribute *attr,
167+
char *buf)
168168
{
169169
struct i2o_device *i2o_dev = to_i2o_device(dev);
170170

171171
sprintf(buf, "0x%03x\n", i2o_dev->lct_data.tid);
172172
return strlen(buf) + 1;
173173
}
174+
static DEVICE_ATTR_RO(tid);
174175

175176
/* I2O device attributes */
176-
struct device_attribute i2o_device_attrs[] = {
177-
__ATTR(class_id, S_IRUGO, i2o_device_show_class_id, NULL),
178-
__ATTR(tid, S_IRUGO, i2o_device_show_tid, NULL),
179-
__ATTR_NULL
177+
static struct attribute *i2o_device_attrs[] = {
178+
&dev_attr_class_id.attr,
179+
&dev_attr_tid.attr,
180+
NULL,
181+
};
182+
183+
static const struct attribute_group i2o_device_group = {
184+
.attrs = i2o_device_attrs,
185+
};
186+
187+
const struct attribute_group *i2o_device_groups[] = {
188+
&i2o_device_group,
189+
NULL,
180190
};
181191

182192
/**

‎drivers/message/i2o/driver.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static int i2o_bus_match(struct device *dev, struct device_driver *drv)
6262
struct bus_type i2o_bus_type = {
6363
.name = "i2o",
6464
.match = i2o_bus_match,
65-
.dev_attrs = i2o_device_attrs
65+
.dev_groups = i2o_device_groups,
6666
};
6767

6868
/**

0 commit comments

Comments
 (0)