From: Steffen Maier <maier@linux.vnet.ibm.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Steffen Maier <maier@linux.vnet.ibm.com>,
Sebastian Ott <sebott@linux.vnet.ibm.com>
Subject: [PATCH RESEND 2/9] zfcp: cleanup port sysfs attribute usage
Date: Fri, 26 Apr 2013 16:13:48 +0200 [thread overview]
Message-ID: <1366985635-38270-3-git-send-email-maier@linux.vnet.ibm.com> (raw)
In-Reply-To: <1366985635-38270-1-git-send-email-maier@linux.vnet.ibm.com>
From: Sebastian Ott <sebott@linux.vnet.ibm.com>
Let the driver core handle device attribute creation and removal. This
will simplify the code and eliminates races between attribute
availability and userspace notification via uevents.
Reviewed-by: Steffen Maier <maier@linux.vnet.ibm.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
drivers/s390/scsi/zfcp_aux.c | 7 +------
drivers/s390/scsi/zfcp_ccw.c | 2 +-
drivers/s390/scsi/zfcp_ext.h | 2 +-
drivers/s390/scsi/zfcp_fc.c | 2 +-
drivers/s390/scsi/zfcp_sysfs.c | 12 ++++++------
5 files changed, 10 insertions(+), 15 deletions(-)
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -530,6 +530,7 @@ struct zfcp_port *zfcp_port_enqueue(stru
port->wwpn = wwpn;
port->rport_task = RPORT_NONE;
port->dev.parent = &adapter->ccw_device->dev;
+ port->dev.groups = zfcp_port_attr_groups;
port->dev.release = zfcp_port_release;
if (dev_set_name(&port->dev, "0x%016llx", (unsigned long long)wwpn)) {
@@ -543,10 +544,6 @@ struct zfcp_port *zfcp_port_enqueue(stru
goto err_out;
}
- if (sysfs_create_group(&port->dev.kobj,
- &zfcp_sysfs_port_attrs))
- goto err_out_put;
-
write_lock_irq(&adapter->port_list_lock);
list_add_tail(&port->list, &adapter->port_list);
write_unlock_irq(&adapter->port_list_lock);
@@ -555,8 +552,6 @@ struct zfcp_port *zfcp_port_enqueue(stru
return port;
-err_out_put:
- device_unregister(&port->dev);
err_out:
zfcp_ccw_adapter_put(adapter);
return ERR_PTR(retval);
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -132,7 +132,7 @@ static void zfcp_ccw_remove(struct ccw_d
zfcp_device_unregister(&unit->dev, &zfcp_sysfs_unit_attrs);
list_for_each_entry_safe(port, p, &port_remove_lh, list)
- zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs);
+ device_unregister(&port->dev);
zfcp_adapter_unregister(adapter);
}
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -160,7 +160,7 @@ extern void zfcp_scsi_dif_sense_error(st
/* zfcp_sysfs.c */
extern struct attribute_group zfcp_sysfs_unit_attrs;
extern struct attribute_group zfcp_sysfs_adapter_attrs;
-extern struct attribute_group zfcp_sysfs_port_attrs;
+extern const struct attribute_group *zfcp_port_attr_groups[];
extern struct mutex zfcp_sysfs_port_units_mutex;
extern struct device_attribute *zfcp_sysfs_sdev_attrs[];
extern struct device_attribute *zfcp_sysfs_shost_attrs[];
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -668,7 +668,7 @@ static int zfcp_fc_eval_gpn_ft(struct zf
list_for_each_entry_safe(port, tmp, &remove_lh, list) {
zfcp_erp_port_shutdown(port, 0, "fcegpf2");
- zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs);
+ device_unregister(&port->dev);
}
return ret;
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -268,7 +268,7 @@ static ssize_t zfcp_sysfs_port_remove_st
put_device(&port->dev);
zfcp_erp_port_shutdown(port, 0, "syprs_1");
- zfcp_device_unregister(&port->dev, &zfcp_sysfs_port_attrs);
+ device_unregister(&port->dev);
out:
zfcp_ccw_adapter_put(adapter);
return retval ? retval : (ssize_t) count;
@@ -340,13 +340,13 @@ static struct attribute *zfcp_port_attrs
&dev_attr_port_access_denied.attr,
NULL
};
-
-/**
- * zfcp_sysfs_port_attrs - sysfs attributes for all other ports
- */
-struct attribute_group zfcp_sysfs_port_attrs = {
+static struct attribute_group zfcp_port_attr_group = {
.attrs = zfcp_port_attrs,
};
+const struct attribute_group *zfcp_port_attr_groups[] = {
+ &zfcp_port_attr_group,
+ NULL,
+};
static struct attribute *zfcp_unit_attrs[] = {
&dev_attr_unit_failed.attr,
next prev parent reply other threads:[~2013-04-26 14:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 14:13 [PATCH RESEND 0/9] zfcp features and bugfixes for 3.10 merge window Steffen Maier
2013-04-26 14:13 ` [PATCH RESEND 1/9] zfcp: cfdc fops add owner Steffen Maier
2013-04-26 14:13 ` Steffen Maier [this message]
2013-04-26 14:13 ` [PATCH RESEND 3/9] zfcp: cleanup unit sysfs attribute usage Steffen Maier
2013-04-26 14:13 ` [PATCH RESEND 4/9] zfcp: remove unused device_unregister wrapper Steffen Maier
2013-04-26 14:13 ` [PATCH RESEND 7/9] zfcp: module parameter dbflevel for early debugging Steffen Maier
2013-04-26 14:13 ` [PATCH RESEND 8/9] zfcp: remove access control tables interface Steffen Maier
2013-04-26 15:10 ` [PATCH RESEND 0/9] zfcp features and bugfixes for 3.10 merge window James Bottomley
2013-04-26 15:44 ` Steffen Maier
2013-04-26 16:10 ` James Bottomley
2013-04-27 9:44 ` Heiko Carstens
[not found] ` <1366985635-38270-6-git-send-email-maier@linux.vnet.ibm.com>
2013-04-26 15:32 ` [PATCH RESEND 5/9] zfcp: fix adapter (re)open recovery while link to SAN is down Steffen Maier
[not found] ` <1366985635-38270-7-git-send-email-maier@linux.vnet.ibm.com>
2013-04-26 15:33 ` [PATCH RESEND 6/9] zfcp: block queue limits with data router Steffen Maier
[not found] ` <1366985635-38270-10-git-send-email-maier@linux.vnet.ibm.com>
2013-04-26 15:34 ` [PATCH RESEND 9/9] zfcp: status read buffers on first adapter open with link down Steffen Maier
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=1366985635-38270-3-git-send-email-maier@linux.vnet.ibm.com \
--to=maier@linux.vnet.ibm.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
--cc=sebott@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox