Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SERIAL] Use an enum for serial8250 platform device IDs

Rather than hard-coding the platform device IDs, enumerate them.
We don't particularly care about the actual ID we get, just as
long as they're unique.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Russell King and committed by
Russell King
6df29deb caf39e87

+41 -26
+1 -1
arch/arm/mach-clps7500/core.c
··· 354 354 355 355 static struct platform_device serial_device = { 356 356 .name = "serial8250", 357 - .id = 0, 357 + .id = PLAT8250_DEV_PLATFORM, 358 358 .dev = { 359 359 .platform_data = serial_platform_data, 360 360 },
+1 -1
arch/arm/mach-ebsa110/core.c
··· 219 219 220 220 static struct platform_device serial_device = { 221 221 .name = "serial8250", 222 - .id = 0, 222 + .id = PLAT8250_DEV_PLATFORM, 223 223 .dev = { 224 224 .platform_data = serial_platform_data, 225 225 },
+1 -1
arch/arm/mach-epxa10db/arch.c
··· 52 52 53 53 static struct platform_device serial_device = { 54 54 .name = "serial8250", 55 - .id = 0, 55 + .id = PLAT8250_DEV_PLATFORM, 56 56 .dev = { 57 57 .platform_data = serial_platform_data, 58 58 },
+1 -1
arch/arm/mach-footbridge/isa.c
··· 34 34 35 35 static struct platform_device serial_device = { 36 36 .name = "serial8250", 37 - .id = 0, 37 + .id = PLAT8250_DEV_PLATFORM, 38 38 .dev = { 39 39 .platform_data = serial_platform_data, 40 40 },
+1 -1
arch/arm/mach-h720x/cpu-h7202.c
··· 90 90 91 91 static struct platform_device serial_device = { 92 92 .name = "serial8250", 93 - .id = 0, 93 + .id = PLAT8250_DEV_PLATFORM, 94 94 .dev = { 95 95 .platform_data = serial_platform_data, 96 96 },
+1 -1
arch/arm/mach-ixp2000/core.c
··· 174 174 175 175 static struct platform_device ixp2000_serial_device = { 176 176 .name = "serial8250", 177 - .id = 0, 177 + .id = PLAT8250_DEV_PLATFORM, 178 178 .dev = { 179 179 .platform_data = ixp2000_serial_port, 180 180 },
+1 -1
arch/arm/mach-ixp4xx/coyote-setup.c
··· 66 66 67 67 static struct platform_device coyote_uart = { 68 68 .name = "serial8250", 69 - .id = 0, 69 + .id = PLAT8250_DEV_PLATFORM, 70 70 .dev = { 71 71 .platform_data = coyote_uart_data, 72 72 },
+1 -1
arch/arm/mach-ixp4xx/gtwx5715-setup.c
··· 93 93 94 94 static struct platform_device gtwx5715_uart_device = { 95 95 .name = "serial8250", 96 - .id = 0, 96 + .id = PLAT8250_DEV_PLATFORM, 97 97 .dev = { 98 98 .platform_data = gtwx5715_uart_platform_data, 99 99 },
+1 -1
arch/arm/mach-ixp4xx/ixdp425-setup.c
··· 96 96 97 97 static struct platform_device ixdp425_uart = { 98 98 .name = "serial8250", 99 - .id = 0, 99 + .id = PLAT8250_DEV_PLATFORM, 100 100 .dev.platform_data = ixdp425_uart_data, 101 101 .num_resources = 2, 102 102 .resource = ixdp425_uart_resources
+1 -1
arch/arm/mach-omap1/board-voiceblue.c
··· 74 74 75 75 static struct platform_device serial_device = { 76 76 .name = "serial8250", 77 - .id = 1, 77 + .id = PLAT8250_DEV_PLATFORM1, 78 78 .dev = { 79 79 .platform_data = voiceblue_ports, 80 80 },
+1 -1
arch/arm/mach-omap1/serial.c
··· 94 94 95 95 static struct platform_device serial_device = { 96 96 .name = "serial8250", 97 - .id = 0, 97 + .id = PLAT8250_DEV_PLATFORM, 98 98 .dev = { 99 99 .platform_data = serial_platform_data, 100 100 },
+1 -1
arch/arm/mach-rpc/riscpc.c
··· 140 140 141 141 static struct platform_device serial_device = { 142 142 .name = "serial8250", 143 - .id = 0, 143 + .id = PLAT8250_DEV_PLATFORM, 144 144 .dev = { 145 145 .platform_data = serial_platform_data, 146 146 },
+1 -1
arch/arm/mach-s3c2410/mach-bast.c
··· 381 381 382 382 static struct platform_device bast_sio = { 383 383 .name = "serial8250", 384 - .id = 0, 384 + .id = PLAT8250_DEV_PLATFORM, 385 385 .dev = { 386 386 .platform_data = &bast_sio_data, 387 387 },
+1 -1
arch/arm/mach-s3c2410/mach-vr1000.c
··· 221 221 222 222 static struct platform_device serial_device = { 223 223 .name = "serial8250", 224 - .id = 0, 224 + .id = PLAT8250_DEV_PLATFORM, 225 225 .dev = { 226 226 .platform_data = serial_platform_data, 227 227 },
+1 -1
arch/arm/mach-shark/core.c
··· 41 41 42 42 static struct platform_device serial_device = { 43 43 .name = "serial8250", 44 - .id = 0, 44 + .id = PLAT8250_DEV_PLATFORM, 45 45 .dev = { 46 46 .platform_data = serial_platform_data, 47 47 },
+2 -2
arch/ppc/syslib/mpc10x_common.c
··· 140 140 }, 141 141 [MPC10X_UART0] = { 142 142 .name = "serial8250", 143 - .id = 0, 143 + .id = PLAT8250_DEV_PLATFORM, 144 144 .dev.platform_data = serial_plat_uart0, 145 145 }, 146 146 [MPC10X_UART1] = { 147 147 .name = "serial8250", 148 - .id = 1, 148 + .id = PLAT8250_DEV_PLATFORM1, 149 149 .dev.platform_data = serial_plat_uart1, 150 150 }, 151 151
+1 -1
arch/ppc/syslib/mpc83xx_devices.c
··· 165 165 }, 166 166 [MPC83xx_DUART] = { 167 167 .name = "serial8250", 168 - .id = 0, 168 + .id = PLAT8250_DEV_PLATFORM, 169 169 .dev.platform_data = serial_platform_data, 170 170 }, 171 171 [MPC83xx_SEC2] = {
+1 -1
arch/ppc/syslib/mpc85xx_devices.c
··· 282 282 }, 283 283 [MPC85xx_DUART] = { 284 284 .name = "serial8250", 285 - .id = 0, 285 + .id = PLAT8250_DEV_PLATFORM, 286 286 .dev.platform_data = serial_platform_data, 287 287 }, 288 288 [MPC85xx_PERFMON] = {
+1 -1
arch/ppc64/kernel/setup.c
··· 1283 1283 1284 1284 static struct platform_device serial_device = { 1285 1285 .name = "serial8250", 1286 - .id = 0, 1286 + .id = PLAT8250_DEV_PLATFORM, 1287 1287 .dev = { 1288 1288 .platform_data = serial_ports, 1289 1289 },
+1 -1
drivers/serial/8250.c
··· 2536 2536 goto out; 2537 2537 2538 2538 serial8250_isa_devs = platform_device_register_simple("serial8250", 2539 - -1, NULL, 0); 2539 + PLAT8250_DEV_LEGACY, NULL, 0); 2540 2540 if (IS_ERR(serial8250_isa_devs)) { 2541 2541 ret = PTR_ERR(serial8250_isa_devs); 2542 2542 goto unreg;
+1 -1
drivers/serial/8250_accent.c
··· 29 29 30 30 static struct platform_device accent_device = { 31 31 .name = "serial8250", 32 - .id = 2, 32 + .id = PLAT8250_DEV_ACCENT, 33 33 .dev = { 34 34 .platform_data = accent_data, 35 35 },
+1 -1
drivers/serial/8250_boca.c
··· 43 43 44 44 static struct platform_device boca_device = { 45 45 .name = "serial8250", 46 - .id = 3, 46 + .id = PLAT8250_DEV_BOCA, 47 47 .dev = { 48 48 .platform_data = boca_data, 49 49 },
+1 -1
drivers/serial/8250_fourport.c
··· 35 35 36 36 static struct platform_device fourport_device = { 37 37 .name = "serial8250", 38 - .id = 1, 38 + .id = PLAT8250_DEV_FOURPORT, 39 39 .dev = { 40 40 .platform_data = fourport_data, 41 41 },
+1 -1
drivers/serial/8250_hub6.c
··· 40 40 41 41 static struct platform_device hub6_device = { 42 42 .name = "serial8250", 43 - .id = 4, 43 + .id = PLAT8250_DEV_HUB6, 44 44 .dev = { 45 45 .platform_data = hub6_data, 46 46 },
+1 -1
drivers/serial/8250_mca.c
··· 44 44 45 45 static struct platform_device mca_device = { 46 46 .name = "serial8250", 47 - .id = 5, 47 + .id = PLAT8250_DEV_MCA, 48 48 .dev = { 49 49 .platform_data = mca_data, 50 50 },
+15
include/linux/serial_8250.h
··· 30 30 }; 31 31 32 32 /* 33 + * Allocate 8250 platform device IDs. Nothing is implied by 34 + * the numbering here, except for the legacy entry being -1. 35 + */ 36 + enum { 37 + PLAT8250_DEV_LEGACY = -1, 38 + PLAT8250_DEV_PLATFORM, 39 + PLAT8250_DEV_PLATFORM1, 40 + PLAT8250_DEV_FOURPORT, 41 + PLAT8250_DEV_ACCENT, 42 + PLAT8250_DEV_BOCA, 43 + PLAT8250_DEV_HUB6, 44 + PLAT8250_DEV_MCA, 45 + }; 46 + 47 + /* 33 48 * This should be used by drivers which want to register 34 49 * their own 8250 ports without registering their own 35 50 * platform device. Using these will make your driver