From e86180325cff63fa6c00fff16c3764f5977f658f Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Thu, 24 Apr 2003 08:39:15 -0700 Subject: [PATCH] [PATCH] ppc boot device selection cleanup 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 | 2 +- arch/ppc/platforms/pmac_setup.c | 18 +++++++++--------- arch/ppc/platforms/prep_setup.c | 2 +- arch/ppc64/kernel/chrp_setup.c | 2 +- drivers/ide/ppc/pmac.c | 4 ++-- fs/partitions/mac.c | 5 ++--- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/arch/ppc/platforms/chrp_setup.c b/arch/ppc/platforms/chrp_setup.c index c057ee92f4f5b..7e9c03c8a09fb 100644 --- a/arch/ppc/platforms/chrp_setup.c +++ b/arch/ppc/platforms/chrp_setup.c @@ -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; diff --git a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c index f89c46fc79595..6c3fb5538d5f5 100644 --- a/arch/ppc/platforms/pmac_setup.c +++ b/arch/ppc/platforms/pmac_setup.c @@ -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; } } diff --git a/arch/ppc/platforms/prep_setup.c b/arch/ppc/platforms/prep_setup.c index 5dd58c936d8a0..574bf95601c98 100644 --- a/arch/ppc/platforms/prep_setup.c +++ b/arch/ppc/platforms/prep_setup.c @@ -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; diff --git a/arch/ppc64/kernel/chrp_setup.c b/arch/ppc64/kernel/chrp_setup.c index 2dfdd6c3b4e8f..748fc3cc3351a 100644 --- a/arch/ppc64/kernel/chrp_setup.c +++ b/arch/ppc64/kernel/chrp_setup.c @@ -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; diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 77c1d417a1139..e86d60a4477df 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -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); } } diff --git a/fs/partitions/mac.c b/fs/partitions/mac.c index cf3dccd6810de..a6cc873d654af 100644 --- a/fs/partitions/mac.c +++ b/fs/partitions/mac.c @@ -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); -- 2.53.0