diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2006-04-27 03:21:46 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-04-29 04:02:01 -0400 |
commit | dd721ffd95d5e1516380da0b254ef737582a258f (patch) | |
tree | fc31c2124b0de8b301622d755e444e4d5acb95b1 /arch | |
parent | e10fa77368dff31140451fac04d78d9f51f0f3ac (diff) |
[PATCH] powerpc: use a common vio_match_device routine
This requires the compatible properties having vaules that are empty
strings instead of just being empty properties.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/vio.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/setup.c | 10 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/vio.c | 12 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/vio.c | 12 |
4 files changed, 7 insertions, 30 deletions
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index 9b46eed5e637..19529297a2dc 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c | |||
@@ -47,7 +47,8 @@ static const struct vio_device_id *vio_match_device( | |||
47 | const struct vio_device_id *ids, const struct vio_dev *dev) | 47 | const struct vio_device_id *ids, const struct vio_dev *dev) |
48 | { | 48 | { |
49 | while (ids->type[0] != '\0') { | 49 | while (ids->type[0] != '\0') { |
50 | if (vio_bus_ops.match(ids, dev)) | 50 | if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) && |
51 | device_is_compatible(dev->dev.platform_data, ids->compat)) | ||
51 | return ids; | 52 | return ids; |
52 | ids++; | 53 | ids++; |
53 | } | 54 | } |
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c index 901acbcc0888..befd36af7e32 100644 --- a/arch/powerpc/platforms/iseries/setup.c +++ b/arch/powerpc/platforms/iseries/setup.c | |||
@@ -927,7 +927,7 @@ void dt_vdevices(struct iseries_flat_dt *dt) | |||
927 | snprintf(buf, sizeof(buf), "viocons@%08x", reg); | 927 | snprintf(buf, sizeof(buf), "viocons@%08x", reg); |
928 | dt_start_node(dt, buf); | 928 | dt_start_node(dt, buf); |
929 | dt_prop_str(dt, "device_type", "serial"); | 929 | dt_prop_str(dt, "device_type", "serial"); |
930 | dt_prop_empty(dt, "compatible"); | 930 | dt_prop_str(dt, "compatible", ""); |
931 | dt_prop_u32(dt, "reg", reg); | 931 | dt_prop_u32(dt, "reg", reg); |
932 | dt_end_node(dt); | 932 | dt_end_node(dt); |
933 | reg++; | 933 | reg++; |
@@ -949,7 +949,7 @@ void dt_vdevices(struct iseries_flat_dt *dt) | |||
949 | snprintf(buf, 32, "vlan@%08x", reg + i); | 949 | snprintf(buf, 32, "vlan@%08x", reg + i); |
950 | dt_start_node(dt, buf); | 950 | dt_start_node(dt, buf); |
951 | dt_prop_str(dt, "device_type", "vlan"); | 951 | dt_prop_str(dt, "device_type", "vlan"); |
952 | dt_prop_empty(dt, "compatible"); | 952 | dt_prop_str(dt, "compatible", ""); |
953 | dt_prop_u32(dt, "reg", reg + i); | 953 | dt_prop_u32(dt, "reg", reg + i); |
954 | dt_prop_u32(dt, "linux,unit_address", i); | 954 | dt_prop_u32(dt, "linux,unit_address", i); |
955 | 955 | ||
@@ -970,7 +970,7 @@ void dt_vdevices(struct iseries_flat_dt *dt) | |||
970 | snprintf(buf, 32, "viodasd@%08x", reg + i); | 970 | snprintf(buf, 32, "viodasd@%08x", reg + i); |
971 | dt_start_node(dt, buf); | 971 | dt_start_node(dt, buf); |
972 | dt_prop_str(dt, "device_type", "viodasd"); | 972 | dt_prop_str(dt, "device_type", "viodasd"); |
973 | dt_prop_empty(dt, "compatible"); | 973 | dt_prop_str(dt, "compatible", ""); |
974 | dt_prop_u32(dt, "reg", reg + i); | 974 | dt_prop_u32(dt, "reg", reg + i); |
975 | dt_prop_u32(dt, "linux,unit_address", i); | 975 | dt_prop_u32(dt, "linux,unit_address", i); |
976 | dt_end_node(dt); | 976 | dt_end_node(dt); |
@@ -980,7 +980,7 @@ void dt_vdevices(struct iseries_flat_dt *dt) | |||
980 | snprintf(buf, 32, "viocd@%08x", reg + i); | 980 | snprintf(buf, 32, "viocd@%08x", reg + i); |
981 | dt_start_node(dt, buf); | 981 | dt_start_node(dt, buf); |
982 | dt_prop_str(dt, "device_type", "viocd"); | 982 | dt_prop_str(dt, "device_type", "viocd"); |
983 | dt_prop_empty(dt, "compatible"); | 983 | dt_prop_str(dt, "compatible", ""); |
984 | dt_prop_u32(dt, "reg", reg + i); | 984 | dt_prop_u32(dt, "reg", reg + i); |
985 | dt_prop_u32(dt, "linux,unit_address", i); | 985 | dt_prop_u32(dt, "linux,unit_address", i); |
986 | dt_end_node(dt); | 986 | dt_end_node(dt); |
@@ -990,7 +990,7 @@ void dt_vdevices(struct iseries_flat_dt *dt) | |||
990 | snprintf(buf, 32, "viotape@%08x", reg + i); | 990 | snprintf(buf, 32, "viotape@%08x", reg + i); |
991 | dt_start_node(dt, buf); | 991 | dt_start_node(dt, buf); |
992 | dt_prop_str(dt, "device_type", "viotape"); | 992 | dt_prop_str(dt, "device_type", "viotape"); |
993 | dt_prop_empty(dt, "compatible"); | 993 | dt_prop_str(dt, "compatible", ""); |
994 | dt_prop_u32(dt, "reg", reg + i); | 994 | dt_prop_u32(dt, "reg", reg + i); |
995 | dt_prop_u32(dt, "linux,unit_address", i); | 995 | dt_prop_u32(dt, "linux,unit_address", i); |
996 | dt_end_node(dt); | 996 | dt_end_node(dt); |
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c index a689da6f2b07..bdd2b7d97d15 100644 --- a/arch/powerpc/platforms/iseries/vio.c +++ b/arch/powerpc/platforms/iseries/vio.c | |||
@@ -50,18 +50,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev) | |||
50 | return &vio_iommu_table; | 50 | return &vio_iommu_table; |
51 | } | 51 | } |
52 | 52 | ||
53 | /** | ||
54 | * vio_match_device_iseries: - Tell if a iSeries VIO device matches a | ||
55 | * vio_device_id | ||
56 | */ | ||
57 | static int vio_match_device_iseries(const struct vio_device_id *id, | ||
58 | const struct vio_dev *dev) | ||
59 | { | ||
60 | return strncmp(dev->type, id->type, strlen(id->type)) == 0; | ||
61 | } | ||
62 | |||
63 | static struct vio_bus_ops vio_bus_ops_iseries = { | 53 | static struct vio_bus_ops vio_bus_ops_iseries = { |
64 | .match = vio_match_device_iseries, | ||
65 | .build_iommu_table = vio_build_iommu_table, | 54 | .build_iommu_table = vio_build_iommu_table, |
66 | }; | 55 | }; |
67 | 56 | ||
@@ -75,5 +64,4 @@ static int __init vio_bus_init_iseries(void) | |||
75 | iSeries_vio_dev = &vio_bus_device.dev; | 64 | iSeries_vio_dev = &vio_bus_device.dev; |
76 | return vio_bus_init(&vio_bus_ops_iseries); | 65 | return vio_bus_init(&vio_bus_ops_iseries); |
77 | } | 66 | } |
78 | |||
79 | __initcall(vio_bus_init_iseries); | 67 | __initcall(vio_bus_init_iseries); |
diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c index b3925aefdac6..d2891661d87b 100644 --- a/arch/powerpc/platforms/pseries/vio.c +++ b/arch/powerpc/platforms/pseries/vio.c | |||
@@ -27,17 +27,6 @@ | |||
27 | extern struct subsystem devices_subsys; /* needed for vio_find_name() */ | 27 | extern struct subsystem devices_subsys; /* needed for vio_find_name() */ |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * vio_match_device_pseries: - Tell if a pSeries VIO device matches a | ||
31 | * vio_device_id | ||
32 | */ | ||
33 | static int vio_match_device_pseries(const struct vio_device_id *id, | ||
34 | const struct vio_dev *dev) | ||
35 | { | ||
36 | return (strncmp(dev->type, id->type, strlen(id->type)) == 0) && | ||
37 | device_is_compatible(dev->dev.platform_data, id->compat); | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | * vio_build_iommu_table: - gets the dma information from OF and | 30 | * vio_build_iommu_table: - gets the dma information from OF and |
42 | * builds the TCE tree. | 31 | * builds the TCE tree. |
43 | * @dev: the virtual device. | 32 | * @dev: the virtual device. |
@@ -76,7 +65,6 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev) | |||
76 | } | 65 | } |
77 | 66 | ||
78 | static struct vio_bus_ops vio_bus_ops_pseries = { | 67 | static struct vio_bus_ops vio_bus_ops_pseries = { |
79 | .match = vio_match_device_pseries, | ||
80 | .build_iommu_table = vio_build_iommu_table, | 68 | .build_iommu_table = vio_build_iommu_table, |
81 | }; | 69 | }; |
82 | 70 | ||