mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-12-09 02:09:06 +00:00
s390/qeth: switch to ccwgroup_create_dev
Switch to the new ccwgroup_create_dev interface. Also wrap device attributes in a struct device_type and let the driver core create these attributes automagically. Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
2ced5514b3
commit
b7169c515b
@ -843,14 +843,13 @@ static inline int qeth_is_diagass_supported(struct qeth_card *card,
|
|||||||
|
|
||||||
extern struct ccwgroup_driver qeth_l2_ccwgroup_driver;
|
extern struct ccwgroup_driver qeth_l2_ccwgroup_driver;
|
||||||
extern struct ccwgroup_driver qeth_l3_ccwgroup_driver;
|
extern struct ccwgroup_driver qeth_l3_ccwgroup_driver;
|
||||||
|
extern const struct attribute_group *qeth_generic_attr_groups[];
|
||||||
|
extern const struct attribute_group *qeth_osn_attr_groups[];
|
||||||
|
|
||||||
const char *qeth_get_cardname_short(struct qeth_card *);
|
const char *qeth_get_cardname_short(struct qeth_card *);
|
||||||
int qeth_realloc_buffer_pool(struct qeth_card *, int);
|
int qeth_realloc_buffer_pool(struct qeth_card *, int);
|
||||||
int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id);
|
int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id);
|
||||||
void qeth_core_free_discipline(struct qeth_card *);
|
void qeth_core_free_discipline(struct qeth_card *);
|
||||||
int qeth_core_create_device_attributes(struct device *);
|
|
||||||
void qeth_core_remove_device_attributes(struct device *);
|
|
||||||
int qeth_core_create_osn_attributes(struct device *);
|
|
||||||
void qeth_core_remove_osn_attributes(struct device *);
|
|
||||||
void qeth_buffer_reclaim_work(struct work_struct *);
|
void qeth_buffer_reclaim_work(struct work_struct *);
|
||||||
|
|
||||||
/* exports for qeth discipline device drivers */
|
/* exports for qeth discipline device drivers */
|
||||||
|
|||||||
@ -4739,13 +4739,6 @@ static struct ccw_driver qeth_ccw_driver = {
|
|||||||
.remove = ccwgroup_remove_ccwdev,
|
.remove = ccwgroup_remove_ccwdev,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int qeth_core_driver_group(const char *buf, struct device *root_dev,
|
|
||||||
unsigned long driver_id)
|
|
||||||
{
|
|
||||||
return ccwgroup_create_from_string(root_dev, driver_id,
|
|
||||||
&qeth_ccw_driver, 3, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
int qeth_core_hardsetup_card(struct qeth_card *card)
|
int qeth_core_hardsetup_card(struct qeth_card *card)
|
||||||
{
|
{
|
||||||
int retries = 0;
|
int retries = 0;
|
||||||
@ -5074,6 +5067,15 @@ void qeth_core_free_discipline(struct qeth_card *card)
|
|||||||
card->discipline.ccwgdriver = NULL;
|
card->discipline.ccwgdriver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct device_type qeth_generic_devtype = {
|
||||||
|
.name = "qeth_generic",
|
||||||
|
.groups = qeth_generic_attr_groups,
|
||||||
|
};
|
||||||
|
static const struct device_type qeth_osn_devtype = {
|
||||||
|
.name = "qeth_osn",
|
||||||
|
.groups = qeth_osn_attr_groups,
|
||||||
|
};
|
||||||
|
|
||||||
static int qeth_core_probe_device(struct ccwgroup_device *gdev)
|
static int qeth_core_probe_device(struct ccwgroup_device *gdev)
|
||||||
{
|
{
|
||||||
struct qeth_card *card;
|
struct qeth_card *card;
|
||||||
@ -5128,17 +5130,16 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (card->info.type == QETH_CARD_TYPE_OSN)
|
if (card->info.type == QETH_CARD_TYPE_OSN)
|
||||||
rc = qeth_core_create_osn_attributes(dev);
|
gdev->dev.type = &qeth_osn_devtype;
|
||||||
else
|
else
|
||||||
rc = qeth_core_create_device_attributes(dev);
|
gdev->dev.type = &qeth_generic_devtype;
|
||||||
if (rc)
|
|
||||||
goto err_dbf;
|
|
||||||
switch (card->info.type) {
|
switch (card->info.type) {
|
||||||
case QETH_CARD_TYPE_OSN:
|
case QETH_CARD_TYPE_OSN:
|
||||||
case QETH_CARD_TYPE_OSM:
|
case QETH_CARD_TYPE_OSM:
|
||||||
rc = qeth_core_load_discipline(card, QETH_DISCIPLINE_LAYER2);
|
rc = qeth_core_load_discipline(card, QETH_DISCIPLINE_LAYER2);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto err_attr;
|
goto err_dbf;
|
||||||
rc = card->discipline.ccwgdriver->probe(card->gdev);
|
rc = card->discipline.ccwgdriver->probe(card->gdev);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto err_disc;
|
goto err_disc;
|
||||||
@ -5157,11 +5158,6 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
|
|||||||
|
|
||||||
err_disc:
|
err_disc:
|
||||||
qeth_core_free_discipline(card);
|
qeth_core_free_discipline(card);
|
||||||
err_attr:
|
|
||||||
if (card->info.type == QETH_CARD_TYPE_OSN)
|
|
||||||
qeth_core_remove_osn_attributes(dev);
|
|
||||||
else
|
|
||||||
qeth_core_remove_device_attributes(dev);
|
|
||||||
err_dbf:
|
err_dbf:
|
||||||
debug_unregister(card->debug);
|
debug_unregister(card->debug);
|
||||||
err_card:
|
err_card:
|
||||||
@ -5178,12 +5174,6 @@ static void qeth_core_remove_device(struct ccwgroup_device *gdev)
|
|||||||
|
|
||||||
QETH_DBF_TEXT(SETUP, 2, "removedv");
|
QETH_DBF_TEXT(SETUP, 2, "removedv");
|
||||||
|
|
||||||
if (card->info.type == QETH_CARD_TYPE_OSN) {
|
|
||||||
qeth_core_remove_osn_attributes(&gdev->dev);
|
|
||||||
} else {
|
|
||||||
qeth_core_remove_device_attributes(&gdev->dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (card->discipline.ccwgdriver) {
|
if (card->discipline.ccwgdriver) {
|
||||||
card->discipline.ccwgdriver->remove(gdev);
|
card->discipline.ccwgdriver->remove(gdev);
|
||||||
qeth_core_free_discipline(card);
|
qeth_core_free_discipline(card);
|
||||||
@ -5286,7 +5276,7 @@ static struct ccwgroup_driver qeth_core_ccwgroup_driver = {
|
|||||||
.name = "qeth",
|
.name = "qeth",
|
||||||
},
|
},
|
||||||
.driver_id = 0xD8C5E3C8,
|
.driver_id = 0xD8C5E3C8,
|
||||||
.probe = qeth_core_probe_device,
|
.setup = qeth_core_probe_device,
|
||||||
.remove = qeth_core_remove_device,
|
.remove = qeth_core_remove_device,
|
||||||
.set_online = qeth_core_set_online,
|
.set_online = qeth_core_set_online,
|
||||||
.set_offline = qeth_core_set_offline,
|
.set_offline = qeth_core_set_offline,
|
||||||
@ -5298,19 +5288,17 @@ static struct ccwgroup_driver qeth_core_ccwgroup_driver = {
|
|||||||
.restore = qeth_core_restore,
|
.restore = qeth_core_restore,
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t qeth_core_driver_group_store(struct device_driver *ddrv,
|
||||||
qeth_core_driver_group_store(struct device_driver *ddrv, const char *buf,
|
const char *buf, size_t count)
|
||||||
size_t count)
|
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
err = qeth_core_driver_group(buf, qeth_core_root_dev,
|
|
||||||
qeth_core_ccwgroup_driver.driver_id);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
else
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
err = ccwgroup_create_dev(qeth_core_root_dev,
|
||||||
|
qeth_core_ccwgroup_driver.driver_id,
|
||||||
|
&qeth_core_ccwgroup_driver, 3, buf);
|
||||||
|
|
||||||
|
return err ? err : count;
|
||||||
|
}
|
||||||
static DRIVER_ATTR(group, 0200, NULL, qeth_core_driver_group_store);
|
static DRIVER_ATTR(group, 0200, NULL, qeth_core_driver_group_store);
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
|||||||
@ -693,7 +693,6 @@ static struct attribute *qeth_blkt_device_attrs[] = {
|
|||||||
&dev_attr_inter_jumbo.attr,
|
&dev_attr_inter_jumbo.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct attribute_group qeth_device_blkt_group = {
|
static struct attribute_group qeth_device_blkt_group = {
|
||||||
.name = "blkt",
|
.name = "blkt",
|
||||||
.attrs = qeth_blkt_device_attrs,
|
.attrs = qeth_blkt_device_attrs,
|
||||||
@ -716,11 +715,16 @@ static struct attribute *qeth_device_attrs[] = {
|
|||||||
&dev_attr_hw_trap.attr,
|
&dev_attr_hw_trap.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct attribute_group qeth_device_attr_group = {
|
static struct attribute_group qeth_device_attr_group = {
|
||||||
.attrs = qeth_device_attrs,
|
.attrs = qeth_device_attrs,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const struct attribute_group *qeth_generic_attr_groups[] = {
|
||||||
|
&qeth_device_attr_group,
|
||||||
|
&qeth_device_blkt_group,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
static struct attribute *qeth_osn_device_attrs[] = {
|
static struct attribute *qeth_osn_device_attrs[] = {
|
||||||
&dev_attr_state.attr,
|
&dev_attr_state.attr,
|
||||||
&dev_attr_chpid.attr,
|
&dev_attr_chpid.attr,
|
||||||
@ -730,37 +734,10 @@ static struct attribute *qeth_osn_device_attrs[] = {
|
|||||||
&dev_attr_recover.attr,
|
&dev_attr_recover.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct attribute_group qeth_osn_device_attr_group = {
|
static struct attribute_group qeth_osn_device_attr_group = {
|
||||||
.attrs = qeth_osn_device_attrs,
|
.attrs = qeth_osn_device_attrs,
|
||||||
};
|
};
|
||||||
|
const struct attribute_group *qeth_osn_attr_groups[] = {
|
||||||
int qeth_core_create_device_attributes(struct device *dev)
|
&qeth_osn_device_attr_group,
|
||||||
{
|
NULL,
|
||||||
int ret;
|
};
|
||||||
ret = sysfs_create_group(&dev->kobj, &qeth_device_attr_group);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
ret = sysfs_create_group(&dev->kobj, &qeth_device_blkt_group);
|
|
||||||
if (ret)
|
|
||||||
sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void qeth_core_remove_device_attributes(struct device *dev)
|
|
||||||
{
|
|
||||||
sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
|
|
||||||
sysfs_remove_group(&dev->kobj, &qeth_device_blkt_group);
|
|
||||||
}
|
|
||||||
|
|
||||||
int qeth_core_create_osn_attributes(struct device *dev)
|
|
||||||
{
|
|
||||||
return sysfs_create_group(&dev->kobj, &qeth_osn_device_attr_group);
|
|
||||||
}
|
|
||||||
|
|
||||||
void qeth_core_remove_osn_attributes(struct device *dev)
|
|
||||||
{
|
|
||||||
sysfs_remove_group(&dev->kobj, &qeth_osn_device_attr_group);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user