aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/css.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/cio/css.c')
-rw-r--r--drivers/s390/cio/css.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 87bd70eeabed..555119cacc27 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -128,34 +128,28 @@ css_probe_device(int irq)
128 return ret; 128 return ret;
129} 129}
130 130
131static int
132check_subchannel(struct device * dev, void * data)
133{
134 struct subchannel *sch;
135 int irq = (unsigned long)data;
136
137 sch = to_subchannel(dev);
138 return (sch->irq == irq);
139}
140
131struct subchannel * 141struct subchannel *
132get_subchannel_by_schid(int irq) 142get_subchannel_by_schid(int irq)
133{ 143{
134 struct subchannel *sch;
135 struct list_head *entry;
136 struct device *dev; 144 struct device *dev;
137 145
138 if (!get_bus(&css_bus_type)) 146 dev = bus_find_device(&css_bus_type, NULL,
139 return NULL; 147 (void *)(unsigned long)irq, check_subchannel);
140 down_read(&css_bus_type.subsys.rwsem);
141 sch = NULL;
142 list_for_each(entry, &css_bus_type.devices.list) {
143 dev = get_device(container_of(entry,
144 struct device, bus_list));
145 if (!dev)
146 continue;
147 sch = to_subchannel(dev);
148 if (sch->irq == irq)
149 break;
150 put_device(dev);
151 sch = NULL;
152 }
153 up_read(&css_bus_type.subsys.rwsem);
154 put_bus(&css_bus_type);
155 148
156 return sch; 149 return dev ? to_subchannel(dev) : NULL;
157} 150}
158 151
152
159static inline int 153static inline int
160css_get_subchannel_status(struct subchannel *sch, int schid) 154css_get_subchannel_status(struct subchannel *sch, int schid)
161{ 155{