From: Tejun Heo <tj@kernel.org>
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, schwidefsky@de.ibm.com,
heiko.carstens@de.ibm.com, stern@rowland.harvard.edu,
JBottomley@parallels.com, bhelgaas@google.com,
Tejun Heo <tj@kernel.org>,
linux-scsi@vger.kernel.org
Subject: [PATCH 10/12] scsi: use device_remove_file_self() instead of device_schedule_callback()
Date: Tue, 7 Jan 2014 12:59:48 -0500 [thread overview]
Message-ID: <1389117590-25705-11-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1389117590-25705-1-git-send-email-tj@kernel.org>
driver-core now supports synchrnous self-deletion of attributes and
the asynchrnous removal mechanism is scheduled for removal. Use it
instead of device_schedule_callback(). This makes "delete" behave
synchronously.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: linux-scsi@vger.kernel.org
---
drivers/scsi/scsi_sysfs.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 8ff62c2..33e6199 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -635,23 +635,12 @@ store_rescan_field (struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field);
-static void sdev_store_delete_callback(struct device *dev)
-{
- scsi_remove_device(to_scsi_device(dev));
-}
-
static ssize_t
sdev_store_delete(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- int rc;
-
- /* An attribute cannot be unregistered by one of its own methods,
- * so we have to use this roundabout approach.
- */
- rc = device_schedule_callback(dev, sdev_store_delete_callback);
- if (rc)
- count = rc;
+ if (device_remove_file_self(dev, attr))
+ scsi_remove_device(to_scsi_device(dev));
return count;
};
static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
--
1.8.4.2
next prev parent reply other threads:[~2014-01-07 18:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 17:59 [PATCHSET driver-core-next] kernfs, sysfs, driver-core: implement synchronous self-removal Tejun Heo
2014-01-07 17:59 ` [PATCH 01/12] kernfs: fix get_active failure handling in kernfs_seq_*() Tejun Heo
2014-01-10 13:48 ` Sasha Levin
2014-01-07 17:59 ` [PATCH 02/12] kernfs: replace kernfs_node->u.completion with kernfs_root->deactivate_waitq Tejun Heo
2014-01-07 17:59 ` [PATCH 03/12] kernfs: restructure removal path to fix possible premature return Tejun Heo
2014-01-07 17:59 ` [PATCH 04/12] kernfs: invoke kernfs_unmap_bin_file() directly from kernfs_deactivate() Tejun Heo
2014-01-07 17:59 ` [PATCH 05/12] kernfs: remove kernfs_addrm_cxt Tejun Heo
2014-01-07 17:59 ` [PATCH 06/12] kernfs: remove KERNFS_ACTIVE_REF and add kernfs_lockdep() Tejun Heo
2014-01-07 17:59 ` [PATCH 07/12] kernfs: remove KERNFS_REMOVED Tejun Heo
2014-01-07 17:59 ` [PATCH 08/12] kernfs, sysfs, driver-core: implement kernfs_remove_self() and its wrappers Tejun Heo
2014-01-07 18:36 ` [PATCH v2 " Tejun Heo
2014-01-07 17:59 ` [PATCH 09/12] pci: use device_remove_file_self() instead of device_schedule_callback() Tejun Heo
2014-01-07 17:59 ` Tejun Heo [this message]
2014-01-07 17:59 ` [PATCH 11/12] s390: " Tejun Heo
2014-01-07 17:59 ` [PATCH 12/12] remove-unused-callback-mechanism Tejun Heo
2014-01-07 18:04 ` [PATCH REPOST 12/12] sysfs, driver-core: remove unused {sysfs|device}_schedule_callback_owner() Tejun Heo
2014-01-07 21:41 ` [PATCHSET driver-core-next] kernfs, sysfs, driver-core: implement synchronous self-removal Tejun Heo
2014-01-08 1:01 ` Greg KH
2014-02-03 19:02 [PATCHSET v5 " Tejun Heo
2014-02-03 19:03 ` [PATCH 10/12] scsi: use device_remove_file_self() instead of device_schedule_callback() Tejun Heo
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=1389117590-25705-11-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=JBottomley@parallels.com \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
--cc=stern@rowland.harvard.edu \
/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;
as well as URLs for NNTP newsgroup(s).