diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-10-23 01:01:49 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-10-23 01:01:49 -0400 |
commit | 3dd41424090a0ca3a660218d06afe6ff4441bad3 (patch) | |
tree | 511ef1bb1799027fc5aad574adce49120ecadd87 /drivers/block/amiflop.c | |
parent | 5c5456402d467969b217d7fdd6670f8c8600f5a8 (diff) | |
parent | f6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff) |
Merge commit 'v2.6.36' into wip-merge-2.6.36
Conflicts:
Makefile
arch/x86/include/asm/unistd_32.h
arch/x86/kernel/syscall_table_32.S
kernel/sched.c
kernel/time/tick-sched.c
Relevant API and functions changes (solved in this commit):
- (API) .enqueue_task() (enqueue_task_litmus),
dequeue_task() (dequeue_task_litmus),
[litmus/sched_litmus.c]
- (API) .select_task_rq() (select_task_rq_litmus)
[litmus/sched_litmus.c]
- (API) sysrq_dump_trace_buffer() and sysrq_handle_kill_rt_tasks()
[litmus/sched_trace.c]
- struct kfifo internal buffer name changed (buffer -> buf)
[litmus/sched_trace.c]
- add_wait_queue_exclusive_locked -> __add_wait_queue_tail_exclusive
[litmus/fmlp.c]
- syscall numbers for both x86_32 and x86_64
Diffstat (limited to 'drivers/block/amiflop.c')
-rw-r--r-- | drivers/block/amiflop.c | 76 |
1 files changed, 46 insertions, 30 deletions
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index 0182a22c423a..76f114f0bba3 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c | |||
@@ -60,12 +60,14 @@ | |||
60 | #include <linux/hdreg.h> | 60 | #include <linux/hdreg.h> |
61 | #include <linux/delay.h> | 61 | #include <linux/delay.h> |
62 | #include <linux/init.h> | 62 | #include <linux/init.h> |
63 | #include <linux/smp_lock.h> | ||
63 | #include <linux/amifdreg.h> | 64 | #include <linux/amifdreg.h> |
64 | #include <linux/amifd.h> | 65 | #include <linux/amifd.h> |
65 | #include <linux/buffer_head.h> | 66 | #include <linux/buffer_head.h> |
66 | #include <linux/blkdev.h> | 67 | #include <linux/blkdev.h> |
67 | #include <linux/elevator.h> | 68 | #include <linux/elevator.h> |
68 | #include <linux/interrupt.h> | 69 | #include <linux/interrupt.h> |
70 | #include <linux/platform_device.h> | ||
69 | 71 | ||
70 | #include <asm/setup.h> | 72 | #include <asm/setup.h> |
71 | #include <asm/uaccess.h> | 73 | #include <asm/uaccess.h> |
@@ -1422,7 +1424,7 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
1422 | return 0; | 1424 | return 0; |
1423 | } | 1425 | } |
1424 | 1426 | ||
1425 | static int fd_ioctl(struct block_device *bdev, fmode_t mode, | 1427 | static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, |
1426 | unsigned int cmd, unsigned long param) | 1428 | unsigned int cmd, unsigned long param) |
1427 | { | 1429 | { |
1428 | struct amiga_floppy_struct *p = bdev->bd_disk->private_data; | 1430 | struct amiga_floppy_struct *p = bdev->bd_disk->private_data; |
@@ -1499,6 +1501,18 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, | |||
1499 | return 0; | 1501 | return 0; |
1500 | } | 1502 | } |
1501 | 1503 | ||
1504 | static int fd_ioctl(struct block_device *bdev, fmode_t mode, | ||
1505 | unsigned int cmd, unsigned long param) | ||
1506 | { | ||
1507 | int ret; | ||
1508 | |||
1509 | lock_kernel(); | ||
1510 | ret = fd_locked_ioctl(bdev, mode, cmd, param); | ||
1511 | unlock_kernel(); | ||
1512 | |||
1513 | return ret; | ||
1514 | } | ||
1515 | |||
1502 | static void fd_probe(int dev) | 1516 | static void fd_probe(int dev) |
1503 | { | 1517 | { |
1504 | unsigned long code; | 1518 | unsigned long code; |
@@ -1541,10 +1555,13 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
1541 | int old_dev; | 1555 | int old_dev; |
1542 | unsigned long flags; | 1556 | unsigned long flags; |
1543 | 1557 | ||
1558 | lock_kernel(); | ||
1544 | old_dev = fd_device[drive]; | 1559 | old_dev = fd_device[drive]; |
1545 | 1560 | ||
1546 | if (fd_ref[drive] && old_dev != system) | 1561 | if (fd_ref[drive] && old_dev != system) { |
1562 | unlock_kernel(); | ||
1547 | return -EBUSY; | 1563 | return -EBUSY; |
1564 | } | ||
1548 | 1565 | ||
1549 | if (mode & (FMODE_READ|FMODE_WRITE)) { | 1566 | if (mode & (FMODE_READ|FMODE_WRITE)) { |
1550 | check_disk_change(bdev); | 1567 | check_disk_change(bdev); |
@@ -1557,8 +1574,10 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
1557 | fd_deselect (drive); | 1574 | fd_deselect (drive); |
1558 | rel_fdc(); | 1575 | rel_fdc(); |
1559 | 1576 | ||
1560 | if (wrprot) | 1577 | if (wrprot) { |
1578 | unlock_kernel(); | ||
1561 | return -EROFS; | 1579 | return -EROFS; |
1580 | } | ||
1562 | } | 1581 | } |
1563 | } | 1582 | } |
1564 | 1583 | ||
@@ -1575,6 +1594,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
1575 | printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive, | 1594 | printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive, |
1576 | unit[drive].type->name, data_types[system].name); | 1595 | unit[drive].type->name, data_types[system].name); |
1577 | 1596 | ||
1597 | unlock_kernel(); | ||
1578 | return 0; | 1598 | return 0; |
1579 | } | 1599 | } |
1580 | 1600 | ||
@@ -1583,6 +1603,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
1583 | struct amiga_floppy_struct *p = disk->private_data; | 1603 | struct amiga_floppy_struct *p = disk->private_data; |
1584 | int drive = p - unit; | 1604 | int drive = p - unit; |
1585 | 1605 | ||
1606 | lock_kernel(); | ||
1586 | if (unit[drive].dirty == 1) { | 1607 | if (unit[drive].dirty == 1) { |
1587 | del_timer (flush_track_timer + drive); | 1608 | del_timer (flush_track_timer + drive); |
1588 | non_int_flush_track (drive); | 1609 | non_int_flush_track (drive); |
@@ -1596,6 +1617,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
1596 | /* the mod_use counter is handled this way */ | 1617 | /* the mod_use counter is handled this way */ |
1597 | floppy_off (drive | 0x40000000); | 1618 | floppy_off (drive | 0x40000000); |
1598 | #endif | 1619 | #endif |
1620 | unlock_kernel(); | ||
1599 | return 0; | 1621 | return 0; |
1600 | } | 1622 | } |
1601 | 1623 | ||
@@ -1637,7 +1659,7 @@ static const struct block_device_operations floppy_fops = { | |||
1637 | .owner = THIS_MODULE, | 1659 | .owner = THIS_MODULE, |
1638 | .open = floppy_open, | 1660 | .open = floppy_open, |
1639 | .release = floppy_release, | 1661 | .release = floppy_release, |
1640 | .locked_ioctl = fd_ioctl, | 1662 | .ioctl = fd_ioctl, |
1641 | .getgeo = fd_getgeo, | 1663 | .getgeo = fd_getgeo, |
1642 | .media_changed = amiga_floppy_change, | 1664 | .media_changed = amiga_floppy_change, |
1643 | }; | 1665 | }; |
@@ -1696,34 +1718,18 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data) | |||
1696 | return get_disk(unit[drive].gendisk); | 1718 | return get_disk(unit[drive].gendisk); |
1697 | } | 1719 | } |
1698 | 1720 | ||
1699 | static int __init amiga_floppy_init(void) | 1721 | static int __init amiga_floppy_probe(struct platform_device *pdev) |
1700 | { | 1722 | { |
1701 | int i, ret; | 1723 | int i, ret; |
1702 | 1724 | ||
1703 | if (!MACH_IS_AMIGA) | ||
1704 | return -ENODEV; | ||
1705 | |||
1706 | if (!AMIGAHW_PRESENT(AMI_FLOPPY)) | ||
1707 | return -ENODEV; | ||
1708 | |||
1709 | if (register_blkdev(FLOPPY_MAJOR,"fd")) | 1725 | if (register_blkdev(FLOPPY_MAJOR,"fd")) |
1710 | return -EBUSY; | 1726 | return -EBUSY; |
1711 | 1727 | ||
1712 | /* | ||
1713 | * We request DSKPTR, DSKLEN and DSKDATA only, because the other | ||
1714 | * floppy registers are too spreaded over the custom register space | ||
1715 | */ | ||
1716 | ret = -EBUSY; | ||
1717 | if (!request_mem_region(CUSTOM_PHYSADDR+0x20, 8, "amiflop [Paula]")) { | ||
1718 | printk("fd: cannot get floppy registers\n"); | ||
1719 | goto out_blkdev; | ||
1720 | } | ||
1721 | |||
1722 | ret = -ENOMEM; | 1728 | ret = -ENOMEM; |
1723 | if ((raw_buf = (char *)amiga_chip_alloc (RAW_BUF_SIZE, "Floppy")) == | 1729 | if ((raw_buf = (char *)amiga_chip_alloc (RAW_BUF_SIZE, "Floppy")) == |
1724 | NULL) { | 1730 | NULL) { |
1725 | printk("fd: cannot get chip mem buffer\n"); | 1731 | printk("fd: cannot get chip mem buffer\n"); |
1726 | goto out_memregion; | 1732 | goto out_blkdev; |
1727 | } | 1733 | } |
1728 | 1734 | ||
1729 | ret = -EBUSY; | 1735 | ret = -EBUSY; |
@@ -1792,18 +1798,13 @@ out_irq2: | |||
1792 | free_irq(IRQ_AMIGA_DSKBLK, NULL); | 1798 | free_irq(IRQ_AMIGA_DSKBLK, NULL); |
1793 | out_irq: | 1799 | out_irq: |
1794 | amiga_chip_free(raw_buf); | 1800 | amiga_chip_free(raw_buf); |
1795 | out_memregion: | ||
1796 | release_mem_region(CUSTOM_PHYSADDR+0x20, 8); | ||
1797 | out_blkdev: | 1801 | out_blkdev: |
1798 | unregister_blkdev(FLOPPY_MAJOR,"fd"); | 1802 | unregister_blkdev(FLOPPY_MAJOR,"fd"); |
1799 | return ret; | 1803 | return ret; |
1800 | } | 1804 | } |
1801 | 1805 | ||
1802 | module_init(amiga_floppy_init); | ||
1803 | #ifdef MODULE | ||
1804 | |||
1805 | #if 0 /* not safe to unload */ | 1806 | #if 0 /* not safe to unload */ |
1806 | void cleanup_module(void) | 1807 | static int __exit amiga_floppy_remove(struct platform_device *pdev) |
1807 | { | 1808 | { |
1808 | int i; | 1809 | int i; |
1809 | 1810 | ||
@@ -1820,12 +1821,25 @@ void cleanup_module(void) | |||
1820 | custom.dmacon = DMAF_DISK; /* disable DMA */ | 1821 | custom.dmacon = DMAF_DISK; /* disable DMA */ |
1821 | amiga_chip_free(raw_buf); | 1822 | amiga_chip_free(raw_buf); |
1822 | blk_cleanup_queue(floppy_queue); | 1823 | blk_cleanup_queue(floppy_queue); |
1823 | release_mem_region(CUSTOM_PHYSADDR+0x20, 8); | ||
1824 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 1824 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
1825 | } | 1825 | } |
1826 | #endif | 1826 | #endif |
1827 | 1827 | ||
1828 | #else | 1828 | static struct platform_driver amiga_floppy_driver = { |
1829 | .driver = { | ||
1830 | .name = "amiga-floppy", | ||
1831 | .owner = THIS_MODULE, | ||
1832 | }, | ||
1833 | }; | ||
1834 | |||
1835 | static int __init amiga_floppy_init(void) | ||
1836 | { | ||
1837 | return platform_driver_probe(&amiga_floppy_driver, amiga_floppy_probe); | ||
1838 | } | ||
1839 | |||
1840 | module_init(amiga_floppy_init); | ||
1841 | |||
1842 | #ifndef MODULE | ||
1829 | static int __init amiga_floppy_setup (char *str) | 1843 | static int __init amiga_floppy_setup (char *str) |
1830 | { | 1844 | { |
1831 | int n; | 1845 | int n; |
@@ -1840,3 +1854,5 @@ static int __init amiga_floppy_setup (char *str) | |||
1840 | 1854 | ||
1841 | __setup("floppy=", amiga_floppy_setup); | 1855 | __setup("floppy=", amiga_floppy_setup); |
1842 | #endif | 1856 | #endif |
1857 | |||
1858 | MODULE_ALIAS("platform:amiga-floppy"); | ||