From: Aaron Lu <aaron.lu@intel.com>
To: Alan Stern <stern@rowland.harvard.edu>,
Oliver Neukum <oliver@neukum.org>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
Jeff Garzik <jgarzik@pobox.com>
Cc: linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org,
linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org,
Aaron Lu <aaron.lwe@gmail.com>, Aaron Lu <aaron.lu@intel.com>
Subject: [PATCH v7 1/6] block: genhd: add an interface to set disk poll interval
Date: Wed, 12 Sep 2012 16:29:52 +0800 [thread overview]
Message-ID: <1347438597-5903-2-git-send-email-aaron.lu@intel.com> (raw)
In-Reply-To: <1347438597-5903-1-git-send-email-aaron.lu@intel.com>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
---
block/genhd.c | 23 +++++++++++++++++------
include/linux/genhd.h | 1 +
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/block/genhd.c b/block/genhd.c
index cac7366..4244256 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1627,6 +1627,19 @@ static void disk_events_workfn(struct work_struct *work)
kobject_uevent_env(&disk_to_dev(disk)->kobj, KOBJ_CHANGE, envp);
}
+int disk_events_set_poll_msecs(struct gendisk *disk, long intv)
+{
+ if (intv < 0 && intv != -1)
+ return -EINVAL;
+
+ disk_block_events(disk);
+ disk->ev->poll_msecs = intv;
+ __disk_unblock_events(disk, true);
+
+ return 0;
+}
+EXPORT_SYMBOL(disk_events_set_poll_msecs);
+
/*
* A disk events enabled device has the following sysfs nodes under
* its /sys/block/X/ directory.
@@ -1683,16 +1696,14 @@ static ssize_t disk_events_poll_msecs_store(struct device *dev,
{
struct gendisk *disk = dev_to_disk(dev);
long intv;
+ int ret;
if (!count || !sscanf(buf, "%ld", &intv))
return -EINVAL;
- if (intv < 0 && intv != -1)
- return -EINVAL;
-
- disk_block_events(disk);
- disk->ev->poll_msecs = intv;
- __disk_unblock_events(disk, true);
+ ret = disk_events_set_poll_msecs(disk, intv);
+ if (ret)
+ return ret;
return count;
}
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 4f440b3..63409e5 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -423,6 +423,7 @@ extern void disk_block_events(struct gendisk *disk);
extern void disk_unblock_events(struct gendisk *disk);
extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask);
+extern int disk_events_set_poll_msecs(struct gendisk *disk, long intv);
/* drivers/char/random.c */
extern void add_disk_randomness(struct gendisk *disk);
--
1.7.12.21.g871e293
next prev parent reply other threads:[~2012-09-12 8:29 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 8:29 [PATCH v7 0/6] ZPODD patches Aaron Lu
2012-09-12 8:29 ` Aaron Lu [this message]
2012-09-20 20:35 ` [PATCH v7 1/6] block: genhd: add an interface to set disk poll interval Rafael J. Wysocki
2012-09-12 8:29 ` [PATCH v7 2/6] scsi: sr: support runtime pm Aaron Lu
2012-09-20 20:48 ` Rafael J. Wysocki
2012-09-20 20:54 ` Alan Stern
2012-09-21 1:02 ` Aaron Lu
2012-09-21 20:49 ` Rafael J. Wysocki
2012-09-24 1:20 ` Aaron Lu
2012-09-24 12:55 ` Rafael J. Wysocki
2012-09-24 14:52 ` Aaron Lu
2012-09-24 21:40 ` Rafael J. Wysocki
2012-09-25 8:01 ` Aaron Lu
2012-09-25 11:47 ` Rafael J. Wysocki
2012-09-25 14:20 ` Aaron Lu
2012-09-25 14:23 ` Oliver Neukum
2012-09-25 14:46 ` Aaron Lu
2012-09-25 21:45 ` Rafael J. Wysocki
2012-09-26 1:03 ` Aaron Lu
2012-09-26 11:18 ` Rafael J. Wysocki
2012-09-26 14:52 ` Aaron Lu
2012-09-26 7:20 ` Oliver Neukum
2012-09-27 10:46 ` Oliver Neukum
2012-09-28 8:20 ` Aaron Lu
2012-09-12 8:29 ` [PATCH v7 3/6] scsi: sr: support zero power ODD(ZPODD) Aaron Lu
2012-09-20 22:07 ` Rafael J. Wysocki
2012-09-21 1:39 ` Aaron Lu
2012-09-21 21:02 ` Rafael J. Wysocki
2012-09-27 9:26 ` Aaron Lu
2012-09-27 14:42 ` Alan Stern
2012-09-27 14:55 ` Aaron Lu
2012-09-27 23:29 ` Rafael J. Wysocki
2012-09-24 21:55 ` Jeff Garzik
2012-09-12 8:29 ` [PATCH v7 4/6] scsi: pm: add may_power_off flag Aaron Lu
2012-09-12 8:29 ` [PATCH v7 5/6] scsi: sr: use may_power_off Aaron Lu
2012-09-12 8:29 ` [PATCH v7 6/6] libata: acpi: respect may_power_off flag Aaron Lu
2012-09-24 21:55 ` Jeff Garzik
2012-09-19 8:03 ` [PATCH v7 0/6] ZPODD patches Aaron Lu
2012-09-19 12:27 ` James Bottomley
2012-09-19 12:50 ` Rafael J. Wysocki
2012-09-19 14:19 ` Aaron Lu
2012-09-20 20:00 ` Rafael J. Wysocki
2012-09-21 5:48 ` Aaron Lu
2012-09-21 21:18 ` Rafael J. Wysocki
2012-09-22 7:32 ` Oliver Neukum
2012-09-22 11:28 ` Rafael J. Wysocki
2012-09-22 15:38 ` Alan Stern
2012-09-22 19:46 ` Rafael J. Wysocki
2012-09-22 20:23 ` Alan Stern
2012-09-22 21:48 ` Rafael J. Wysocki
2012-09-24 2:55 ` Aaron Lu
2012-09-24 13:06 ` Rafael J. Wysocki
2012-09-24 15:04 ` Aaron Lu
2012-09-24 21:46 ` Rafael J. Wysocki
2012-09-25 8:18 ` Aaron Lu
2012-09-25 11:02 ` James Bottomley
2012-09-25 13:56 ` Aaron Lu
2012-09-27 9:43 ` Aaron Lu
2012-09-19 14:52 ` James Bottomley
2012-09-20 21:46 ` Rafael J. Wysocki
2012-09-19 13:05 ` Oliver Neukum
2012-09-19 15:19 ` David Woodhouse
2012-09-20 0:34 ` Jack Wang
[not found] ` <201209280115.06964.rjw@sisk.pl>
[not found] ` <5064FA08.6030005@intel.com>
[not found] ` <201209282346.15872.rjw@sisk.pl>
2012-09-29 2:10 ` [PATCH v7 2/6] scsi: sr: support runtime pm Aaron Lu
2012-09-29 14:29 ` Alan Stern
2012-09-29 15:03 ` Aaron Lu
2012-09-29 22:44 ` Rafael J. Wysocki
2012-09-30 12:32 ` Aaron Lu
2012-09-30 14:47 ` Alan Stern
2012-09-30 15:39 ` Aaron Lu
2012-09-30 19:15 ` Jeff Garzik
2012-09-30 19:08 ` Jeff Garzik
2012-09-29 22:31 ` Rafael J. Wysocki
2012-09-30 19:03 ` Jeff Garzik
2012-09-30 19:43 ` Alan Stern
2012-10-01 4:57 ` Jeff Garzik
2012-10-08 9:27 ` Aaron Lu
2012-10-08 10:21 ` James Bottomley
2012-10-09 7:20 ` Aaron Lu
2012-10-09 14:58 ` James Bottomley
2012-10-11 7:49 ` Aaron Lu
2012-10-09 23:26 ` Rafael J. Wysocki
2012-09-29 22:27 ` Rafael J. Wysocki
2012-09-30 12:38 ` Aaron Lu
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=1347438597-5903-2-git-send-email-aaron.lu@intel.com \
--to=aaron.lu@intel.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=aaron.lwe@gmail.com \
--cc=jgarzik@pobox.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=oliver@neukum.org \
--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).