swim.c (7483d45f0aee3afc0646d185cabd4af9f6cab58c) swim.c (8d85fce77edfc22f1d6dbf78e3af723b4b556f3d)
1/*
2 * Driver for SWIM (Sander Woz Integrated Machine) floppy controller
3 *
4 * Copyright (C) 2004,2008 Laurent Vivier <Laurent@lvivier.info>
5 *
6 * based on Alastair Bridgewater SWIM analysis, 2001
7 * based on SWIM3 driver (c) Paul Mackerras, 1996
8 * based on netBSD IWM driver (c) 1997, 1998 Hauke Fath.

--- 774 unchanged lines hidden (view full) ---

783
784 if (drive > swd->floppy_count)
785 return NULL;
786
787 *part = 0;
788 return get_disk(swd->unit[drive].disk);
789}
790
1/*
2 * Driver for SWIM (Sander Woz Integrated Machine) floppy controller
3 *
4 * Copyright (C) 2004,2008 Laurent Vivier <Laurent@lvivier.info>
5 *
6 * based on Alastair Bridgewater SWIM analysis, 2001
7 * based on SWIM3 driver (c) Paul Mackerras, 1996
8 * based on netBSD IWM driver (c) 1997, 1998 Hauke Fath.

--- 774 unchanged lines hidden (view full) ---

783
784 if (drive > swd->floppy_count)
785 return NULL;
786
787 *part = 0;
788 return get_disk(swd->unit[drive].disk);
789}
790
791static int __devinit swim_add_floppy(struct swim_priv *swd,
792 enum drive_location location)
791static int swim_add_floppy(struct swim_priv *swd, enum drive_location location)
793{
794 struct floppy_state *fs = &swd->unit[swd->floppy_count];
795 struct swim __iomem *base = swd->base;
796
797 fs->location = location;
798
799 swim_drive(base, location);
800

--- 6 unchanged lines hidden (view full) ---

807 fs->ref_count = 0;
808 fs->ejected = 1;
809
810 swd->floppy_count++;
811
812 return 0;
813}
814
792{
793 struct floppy_state *fs = &swd->unit[swd->floppy_count];
794 struct swim __iomem *base = swd->base;
795
796 fs->location = location;
797
798 swim_drive(base, location);
799

--- 6 unchanged lines hidden (view full) ---

806 fs->ref_count = 0;
807 fs->ejected = 1;
808
809 swd->floppy_count++;
810
811 return 0;
812}
813
815static int __devinit swim_floppy_init(struct swim_priv *swd)
814static int swim_floppy_init(struct swim_priv *swd)
816{
817 int err;
818 int drive;
819 struct swim __iomem *base = swd->base;
820
821 /* scan floppy drives */
822
823 swim_drive(base, INTERNAL_DRIVE);

--- 46 unchanged lines hidden (view full) ---

870
871exit_put_disks:
872 unregister_blkdev(FLOPPY_MAJOR, "fd");
873 while (drive--)
874 put_disk(swd->unit[drive].disk);
875 return err;
876}
877
815{
816 int err;
817 int drive;
818 struct swim __iomem *base = swd->base;
819
820 /* scan floppy drives */
821
822 swim_drive(base, INTERNAL_DRIVE);

--- 46 unchanged lines hidden (view full) ---

869
870exit_put_disks:
871 unregister_blkdev(FLOPPY_MAJOR, "fd");
872 while (drive--)
873 put_disk(swd->unit[drive].disk);
874 return err;
875}
876
878static int __devinit swim_probe(struct platform_device *dev)
877static int swim_probe(struct platform_device *dev)
879{
880 struct resource *res;
881 struct swim __iomem *swim_base;
882 struct swim_priv *swd;
883 int ret;
884
885 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
886 if (!res) {

--- 44 unchanged lines hidden (view full) ---

931out_iounmap:
932 iounmap(swim_base);
933out_release_io:
934 release_mem_region(res->start, resource_size(res));
935out:
936 return ret;
937}
938
878{
879 struct resource *res;
880 struct swim __iomem *swim_base;
881 struct swim_priv *swd;
882 int ret;
883
884 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
885 if (!res) {

--- 44 unchanged lines hidden (view full) ---

930out_iounmap:
931 iounmap(swim_base);
932out_release_io:
933 release_mem_region(res->start, resource_size(res));
934out:
935 return ret;
936}
937
939static int __devexit swim_remove(struct platform_device *dev)
938static int swim_remove(struct platform_device *dev)
940{
941 struct swim_priv *swd = platform_get_drvdata(dev);
942 int drive;
943 struct resource *res;
944
945 blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
946
947 for (drive = 0; drive < swd->floppy_count; drive++) {

--- 19 unchanged lines hidden (view full) ---

967 platform_set_drvdata(dev, NULL);
968 kfree(swd);
969
970 return 0;
971}
972
973static struct platform_driver swim_driver = {
974 .probe = swim_probe,
939{
940 struct swim_priv *swd = platform_get_drvdata(dev);
941 int drive;
942 struct resource *res;
943
944 blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
945
946 for (drive = 0; drive < swd->floppy_count; drive++) {

--- 19 unchanged lines hidden (view full) ---

966 platform_set_drvdata(dev, NULL);
967 kfree(swd);
968
969 return 0;
970}
971
972static struct platform_driver swim_driver = {
973 .probe = swim_probe,
975 .remove = __devexit_p(swim_remove),
974 .remove = swim_remove,
976 .driver = {
977 .name = CARDNAME,
978 .owner = THIS_MODULE,
979 },
980};
981
982static int __init swim_init(void)
983{

--- 16 unchanged lines hidden ---
975 .driver = {
976 .name = CARDNAME,
977 .owner = THIS_MODULE,
978 },
979};
980
981static int __init swim_init(void)
982{

--- 16 unchanged lines hidden ---