diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/aoe/aoe.h | 2 | ||||
-rw-r--r-- | drivers/block/aoe/aoechr.c | 2 | ||||
-rw-r--r-- | drivers/block/aoe/aoecmd.c | 15 | ||||
-rw-r--r-- | drivers/block/genhd.c | 25 | ||||
-rw-r--r-- | drivers/block/paride/pg.c | 2 | ||||
-rw-r--r-- | drivers/block/paride/pt.c | 4 |
6 files changed, 38 insertions, 12 deletions
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h index 0e9e586e9ba3..881c48d941b7 100644 --- a/drivers/block/aoe/aoe.h +++ b/drivers/block/aoe/aoe.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ | 1 | /* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ |
2 | #define VERSION "12" | 2 | #define VERSION "14" |
3 | #define AOE_MAJOR 152 | 3 | #define AOE_MAJOR 152 |
4 | #define DEVICE_NAME "aoe" | 4 | #define DEVICE_NAME "aoe" |
5 | 5 | ||
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c index 45a243096187..41ae0ede619a 100644 --- a/drivers/block/aoe/aoechr.c +++ b/drivers/block/aoe/aoechr.c | |||
@@ -224,7 +224,7 @@ aoechr_init(void) | |||
224 | return PTR_ERR(aoe_class); | 224 | return PTR_ERR(aoe_class); |
225 | } | 225 | } |
226 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) | 226 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) |
227 | class_device_create(aoe_class, | 227 | class_device_create(aoe_class, NULL, |
228 | MKDEV(AOE_MAJOR, chardevs[i].minor), | 228 | MKDEV(AOE_MAJOR, chardevs[i].minor), |
229 | NULL, chardevs[i].name); | 229 | NULL, chardevs[i].name); |
230 | 230 | ||
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index b5be4b7d7b5b..5c9c7c1a3d4c 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/blkdev.h> | 8 | #include <linux/blkdev.h> |
9 | #include <linux/skbuff.h> | 9 | #include <linux/skbuff.h> |
10 | #include <linux/netdevice.h> | 10 | #include <linux/netdevice.h> |
11 | #include <asm/unaligned.h> | ||
11 | #include "aoe.h" | 12 | #include "aoe.h" |
12 | 13 | ||
13 | #define TIMERTICK (HZ / 10) | 14 | #define TIMERTICK (HZ / 10) |
@@ -311,16 +312,16 @@ ataid_complete(struct aoedev *d, unsigned char *id) | |||
311 | u16 n; | 312 | u16 n; |
312 | 313 | ||
313 | /* word 83: command set supported */ | 314 | /* word 83: command set supported */ |
314 | n = le16_to_cpup((__le16 *) &id[83<<1]); | 315 | n = le16_to_cpu(get_unaligned((__le16 *) &id[83<<1])); |
315 | 316 | ||
316 | /* word 86: command set/feature enabled */ | 317 | /* word 86: command set/feature enabled */ |
317 | n |= le16_to_cpup((__le16 *) &id[86<<1]); | 318 | n |= le16_to_cpu(get_unaligned((__le16 *) &id[86<<1])); |
318 | 319 | ||
319 | if (n & (1<<10)) { /* bit 10: LBA 48 */ | 320 | if (n & (1<<10)) { /* bit 10: LBA 48 */ |
320 | d->flags |= DEVFL_EXT; | 321 | d->flags |= DEVFL_EXT; |
321 | 322 | ||
322 | /* word 100: number lba48 sectors */ | 323 | /* word 100: number lba48 sectors */ |
323 | ssize = le64_to_cpup((__le64 *) &id[100<<1]); | 324 | ssize = le64_to_cpu(get_unaligned((__le64 *) &id[100<<1])); |
324 | 325 | ||
325 | /* set as in ide-disk.c:init_idedisk_capacity */ | 326 | /* set as in ide-disk.c:init_idedisk_capacity */ |
326 | d->geo.cylinders = ssize; | 327 | d->geo.cylinders = ssize; |
@@ -331,12 +332,12 @@ ataid_complete(struct aoedev *d, unsigned char *id) | |||
331 | d->flags &= ~DEVFL_EXT; | 332 | d->flags &= ~DEVFL_EXT; |
332 | 333 | ||
333 | /* number lba28 sectors */ | 334 | /* number lba28 sectors */ |
334 | ssize = le32_to_cpup((__le32 *) &id[60<<1]); | 335 | ssize = le32_to_cpu(get_unaligned((__le32 *) &id[60<<1])); |
335 | 336 | ||
336 | /* NOTE: obsolete in ATA 6 */ | 337 | /* NOTE: obsolete in ATA 6 */ |
337 | d->geo.cylinders = le16_to_cpup((__le16 *) &id[54<<1]); | 338 | d->geo.cylinders = le16_to_cpu(get_unaligned((__le16 *) &id[54<<1])); |
338 | d->geo.heads = le16_to_cpup((__le16 *) &id[55<<1]); | 339 | d->geo.heads = le16_to_cpu(get_unaligned((__le16 *) &id[55<<1])); |
339 | d->geo.sectors = le16_to_cpup((__le16 *) &id[56<<1]); | 340 | d->geo.sectors = le16_to_cpu(get_unaligned((__le16 *) &id[56<<1])); |
340 | } | 341 | } |
341 | d->ssize = ssize; | 342 | d->ssize = ssize; |
342 | d->geo.start = 0; | 343 | d->geo.start = 0; |
diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c index d42840cc0d1d..486ce1fdeb8c 100644 --- a/drivers/block/genhd.c +++ b/drivers/block/genhd.c | |||
@@ -337,10 +337,30 @@ static ssize_t disk_attr_show(struct kobject *kobj, struct attribute *attr, | |||
337 | return ret; | 337 | return ret; |
338 | } | 338 | } |
339 | 339 | ||
340 | static ssize_t disk_attr_store(struct kobject * kobj, struct attribute * attr, | ||
341 | const char *page, size_t count) | ||
342 | { | ||
343 | struct gendisk *disk = to_disk(kobj); | ||
344 | struct disk_attribute *disk_attr = | ||
345 | container_of(attr,struct disk_attribute,attr); | ||
346 | ssize_t ret = 0; | ||
347 | |||
348 | if (disk_attr->store) | ||
349 | ret = disk_attr->store(disk, page, count); | ||
350 | return ret; | ||
351 | } | ||
352 | |||
340 | static struct sysfs_ops disk_sysfs_ops = { | 353 | static struct sysfs_ops disk_sysfs_ops = { |
341 | .show = &disk_attr_show, | 354 | .show = &disk_attr_show, |
355 | .store = &disk_attr_store, | ||
342 | }; | 356 | }; |
343 | 357 | ||
358 | static ssize_t disk_uevent_store(struct gendisk * disk, | ||
359 | const char *buf, size_t count) | ||
360 | { | ||
361 | kobject_hotplug(&disk->kobj, KOBJ_ADD); | ||
362 | return count; | ||
363 | } | ||
344 | static ssize_t disk_dev_read(struct gendisk * disk, char *page) | 364 | static ssize_t disk_dev_read(struct gendisk * disk, char *page) |
345 | { | 365 | { |
346 | dev_t base = MKDEV(disk->major, disk->first_minor); | 366 | dev_t base = MKDEV(disk->major, disk->first_minor); |
@@ -382,6 +402,10 @@ static ssize_t disk_stats_read(struct gendisk * disk, char *page) | |||
382 | jiffies_to_msecs(disk_stat_read(disk, io_ticks)), | 402 | jiffies_to_msecs(disk_stat_read(disk, io_ticks)), |
383 | jiffies_to_msecs(disk_stat_read(disk, time_in_queue))); | 403 | jiffies_to_msecs(disk_stat_read(disk, time_in_queue))); |
384 | } | 404 | } |
405 | static struct disk_attribute disk_attr_uevent = { | ||
406 | .attr = {.name = "uevent", .mode = S_IWUSR }, | ||
407 | .store = disk_uevent_store | ||
408 | }; | ||
385 | static struct disk_attribute disk_attr_dev = { | 409 | static struct disk_attribute disk_attr_dev = { |
386 | .attr = {.name = "dev", .mode = S_IRUGO }, | 410 | .attr = {.name = "dev", .mode = S_IRUGO }, |
387 | .show = disk_dev_read | 411 | .show = disk_dev_read |
@@ -404,6 +428,7 @@ static struct disk_attribute disk_attr_stat = { | |||
404 | }; | 428 | }; |
405 | 429 | ||
406 | static struct attribute * default_attrs[] = { | 430 | static struct attribute * default_attrs[] = { |
431 | &disk_attr_uevent.attr, | ||
407 | &disk_attr_dev.attr, | 432 | &disk_attr_dev.attr, |
408 | &disk_attr_range.attr, | 433 | &disk_attr_range.attr, |
409 | &disk_attr_removable.attr, | 434 | &disk_attr_removable.attr, |
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index b3982395f22b..82f2d6d2eeef 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
@@ -674,7 +674,7 @@ static int __init pg_init(void) | |||
674 | for (unit = 0; unit < PG_UNITS; unit++) { | 674 | for (unit = 0; unit < PG_UNITS; unit++) { |
675 | struct pg *dev = &devices[unit]; | 675 | struct pg *dev = &devices[unit]; |
676 | if (dev->present) { | 676 | if (dev->present) { |
677 | class_device_create(pg_class, MKDEV(major, unit), | 677 | class_device_create(pg_class, NULL, MKDEV(major, unit), |
678 | NULL, "pg%u", unit); | 678 | NULL, "pg%u", unit); |
679 | err = devfs_mk_cdev(MKDEV(major, unit), | 679 | err = devfs_mk_cdev(MKDEV(major, unit), |
680 | S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u", | 680 | S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u", |
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index d8d35233cf49..686c95573452 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c | |||
@@ -971,7 +971,7 @@ static int __init pt_init(void) | |||
971 | devfs_mk_dir("pt"); | 971 | devfs_mk_dir("pt"); |
972 | for (unit = 0; unit < PT_UNITS; unit++) | 972 | for (unit = 0; unit < PT_UNITS; unit++) |
973 | if (pt[unit].present) { | 973 | if (pt[unit].present) { |
974 | class_device_create(pt_class, MKDEV(major, unit), | 974 | class_device_create(pt_class, NULL, MKDEV(major, unit), |
975 | NULL, "pt%d", unit); | 975 | NULL, "pt%d", unit); |
976 | err = devfs_mk_cdev(MKDEV(major, unit), | 976 | err = devfs_mk_cdev(MKDEV(major, unit), |
977 | S_IFCHR | S_IRUSR | S_IWUSR, | 977 | S_IFCHR | S_IRUSR | S_IWUSR, |
@@ -980,7 +980,7 @@ static int __init pt_init(void) | |||
980 | class_device_destroy(pt_class, MKDEV(major, unit)); | 980 | class_device_destroy(pt_class, MKDEV(major, unit)); |
981 | goto out_class; | 981 | goto out_class; |
982 | } | 982 | } |
983 | class_device_create(pt_class, MKDEV(major, unit + 128), | 983 | class_device_create(pt_class, NULL, MKDEV(major, unit + 128), |
984 | NULL, "pt%dn", unit); | 984 | NULL, "pt%dn", unit); |
985 | err = devfs_mk_cdev(MKDEV(major, unit + 128), | 985 | err = devfs_mk_cdev(MKDEV(major, unit + 128), |
986 | S_IFCHR | S_IRUSR | S_IWUSR, | 986 | S_IFCHR | S_IRUSR | S_IWUSR, |