]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ppc boot device selection cleanup
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>
Thu, 24 Apr 2003 15:39:15 +0000 (08:39 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Thu, 24 Apr 2003 15:39:15 +0000 (08:39 -0700)
PPC logics for choice of default boot device number switched to
dev_t.  Rationale: it belongs to userland; we notice partitions with
certain properties and choose one of them as the best candidate for
being a root fs; then we put the resulting device number into ROOT_DEV,
which has only one use - it's passed to mknod(2) to create a device node
on rootfs and allow mount(2) get us the final root.

IOW, all that code has nothing whatsoever with kernel internals
of any description - the value we are generating will be passed to
mknod(2) anyway.  Switched to dev_t.

Note: that code should eventually be moved to early userland.

arch/ppc/platforms/chrp_setup.c
arch/ppc/platforms/pmac_setup.c
arch/ppc/platforms/prep_setup.c
arch/ppc64/kernel/chrp_setup.c
drivers/ide/ppc/pmac.c
fs/partitions/mac.c

index c057ee92f4f5bd50dbb3967bb7edae88b189a886..7e9c03c8a09fb5fc8ab204d346e0e75a62a3aed0 100644 (file)
@@ -67,7 +67,7 @@ void btext_progress(char *, unsigned short);
 extern unsigned long pmac_find_end_of_memory(void);
 extern int of_show_percpuinfo(struct seq_file *, int);
 
-extern kdev_t boot_dev;
+extern dev_t boot_dev;
 
 extern PTE *Hash, *Hash_end;
 extern unsigned long Hash_size, Hash_mask;
index f89c46fc79595f04066a238c3598938ca82f3b0d..6c3fb5538d5f51932645a5396cee00c1220a8bad 100644 (file)
@@ -364,7 +364,7 @@ extern char *bootdevice;
 void *boot_host;
 int boot_target;
 int boot_part;
-extern kdev_t boot_dev;
+extern dev_t boot_dev;
 
 #ifdef CONFIG_SCSI
 void __init
@@ -398,18 +398,18 @@ note_scsi_host(struct device_node *node, void *host)
 #endif
 
 #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
-kdev_t __init
+dev_t __init
 find_ide_boot(void)
 {
        char *p;
        int n;
-       kdev_t __init pmac_find_ide_boot(char *bootdevice, int n);
+       dev_t __init pmac_find_ide_boot(char *bootdevice, int n);
 
        if (bootdevice == NULL)
-               return NODEV;
+               return 0;
        p = strrchr(bootdevice, '/');
        if (p == NULL)
-               return NODEV;
+               return 0;
        n = p - bootdevice;
 
        return pmac_find_ide_boot(bootdevice, n);
@@ -436,7 +436,7 @@ late_initcall(pmac_late_init);
 
 /* can't be __init - can be called whenever a disk is first accessed */
 void __pmac
-note_bootable_part(kdev_t dev, int part, int goodness)
+note_bootable_part(dev_t dev, int part, int goodness)
 {
        static int found_boot = 0;
        char *p;
@@ -454,9 +454,9 @@ note_bootable_part(kdev_t dev, int part, int goodness)
                find_boot_device();
                found_boot = 1;
        }
-       if (kdev_same(boot_dev, NODEV) || kdev_same(dev, boot_dev)) {
-               ROOT_DEV = MKDEV(major(dev), minor(dev) + part);
-               boot_dev = NODEV;
+       if (!boot_dev || dev == boot_dev) {
+               ROOT_DEV = dev + part;
+               boot_dev = 0;
                current_root_goodness = goodness;
        }
 }
index 5dd58c936d8a0718a9cc56865a91d0386c44b4e6..574bf95601c98e40a92dc11c27bd70dd10a2f7cc 100644 (file)
@@ -91,7 +91,7 @@ extern void prep_tiger1_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi
 #define cached_A1      (((char *)(ppc_cached_irq_mask))[2])
 
 /* for the mac fs */
-kdev_t boot_dev;
+dev_t boot_dev;
 
 #ifdef CONFIG_SOUND_CS4232 
 long ppc_cs4232_dma, ppc_cs4232_dma2;
index 2dfdd6c3b4e8f52f8b11a8c22dc954152dc64027..748fc3cc3351a7c866259b2f3c93383eb43b99e6 100644 (file)
@@ -79,7 +79,7 @@ void fwnmi_init(void);
 extern void SystemReset_FWNMI(void), MachineCheck_FWNMI(void); /* from head.S */
 int fwnmi_active;  /* TRUE if an FWNMI handler is present */
 
-kdev_t boot_dev;
+dev_t boot_dev;
 unsigned long  virtPython0Facilities = 0;  // python0 facility area (memory mapped io) (64-bit format) VIRTUAL address.
 
 extern unsigned long loops_per_jiffy;
index 77c1d417a1139f4991d1ffca2e48dae8ce512bb4..e86d60a4477df1c5a634898b5a1306132eb08b90 100644 (file)
@@ -702,7 +702,7 @@ pmac_ide_get_irq(unsigned long base)
 
 static int ide_majors[]  __pmacdata = { 3, 22, 33, 34, 56, 57 };
 
-kdev_t __init
+dev_t __init
 pmac_find_ide_boot(char *bootdevice, int n)
 {
        int i;
@@ -717,7 +717,7 @@ pmac_find_ide_boot(char *bootdevice, int n)
                name = pmac_ide[i].node->full_name;
                if (memcmp(name, bootdevice, n) == 0 && name[n] == 0) {
                        /* XXX should cope with the 2nd drive as well... */
-                       return mk_kdev(ide_majors[i], 0);
+                       return MKDEV(ide_majors[i], 0);
                }
        }
 
index cf3dccd6810dead90312859804062510b63083fc..a6cc873d654af79f8d673bdb226b4bf1b9fef9c6 100644 (file)
@@ -12,7 +12,7 @@
 #include "mac.h"
 
 #ifdef CONFIG_ALL_PPC
-extern void note_bootable_part(kdev_t dev, int part, int goodness);
+extern void note_bootable_part(dev_t dev, int part, int goodness);
 #endif
 
 /*
@@ -121,8 +121,7 @@ int mac_partition(struct parsed_partitions *state, struct block_device *bdev)
        }
 #ifdef CONFIG_ALL_PPC
        if (found_root_goodness)
-               note_bootable_part(to_kdev_t(bdev->bd_dev),
-                                       found_root, found_root_goodness);
+               note_bootable_part(bdev->bd_dev, found_root, found_root_goodness);
 #endif
 
        put_dev_sector(sect);