diff options
Diffstat (limited to 'drivers/ieee1394/dv1394.c')
-rw-r--r-- | drivers/ieee1394/dv1394.c | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 1084da4d88a9..55d6ae664fd6 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -2255,49 +2255,37 @@ static int dv1394_init(struct ti_ohci *ohci, enum pal_or_ntsc format, enum modes | |||
2255 | return 0; | 2255 | return 0; |
2256 | } | 2256 | } |
2257 | 2257 | ||
2258 | static void dv1394_un_init(struct video_card *video) | 2258 | static void dv1394_remove_host(struct hpsb_host *host) |
2259 | { | 2259 | { |
2260 | /* obviously nobody has the driver open at this point */ | 2260 | struct video_card *video, *tmp_video; |
2261 | do_dv1394_shutdown(video, 1); | ||
2262 | kfree(video); | ||
2263 | } | ||
2264 | |||
2265 | |||
2266 | static void dv1394_remove_host (struct hpsb_host *host) | ||
2267 | { | ||
2268 | struct video_card *video; | ||
2269 | unsigned long flags; | 2261 | unsigned long flags; |
2270 | int id = host->id; | 2262 | int found_ohci_card = 0; |
2271 | 2263 | ||
2272 | /* We only work with the OHCI-1394 driver */ | ||
2273 | if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME)) | ||
2274 | return; | ||
2275 | |||
2276 | /* find the corresponding video_cards */ | ||
2277 | do { | 2264 | do { |
2278 | struct video_card *tmp_vid; | ||
2279 | |||
2280 | video = NULL; | 2265 | video = NULL; |
2281 | |||
2282 | spin_lock_irqsave(&dv1394_cards_lock, flags); | 2266 | spin_lock_irqsave(&dv1394_cards_lock, flags); |
2283 | list_for_each_entry(tmp_vid, &dv1394_cards, list) { | 2267 | list_for_each_entry(tmp_video, &dv1394_cards, list) { |
2284 | if ((tmp_vid->id >> 2) == id) { | 2268 | if ((tmp_video->id >> 2) == host->id) { |
2285 | list_del(&tmp_vid->list); | 2269 | list_del(&tmp_video->list); |
2286 | video = tmp_vid; | 2270 | video = tmp_video; |
2271 | found_ohci_card = 1; | ||
2287 | break; | 2272 | break; |
2288 | } | 2273 | } |
2289 | } | 2274 | } |
2290 | spin_unlock_irqrestore(&dv1394_cards_lock, flags); | 2275 | spin_unlock_irqrestore(&dv1394_cards_lock, flags); |
2291 | 2276 | ||
2292 | if (video) | 2277 | if (video) { |
2293 | dv1394_un_init(video); | 2278 | do_dv1394_shutdown(video, 1); |
2294 | } while (video != NULL); | 2279 | kfree(video); |
2280 | } | ||
2281 | } while (video); | ||
2295 | 2282 | ||
2296 | class_device_destroy(hpsb_protocol_class, | 2283 | if (found_ohci_card) |
2297 | MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2))); | 2284 | class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, |
2285 | IEEE1394_MINOR_BLOCK_DV1394 * 16 + (host->id << 2))); | ||
2298 | } | 2286 | } |
2299 | 2287 | ||
2300 | static void dv1394_add_host (struct hpsb_host *host) | 2288 | static void dv1394_add_host(struct hpsb_host *host) |
2301 | { | 2289 | { |
2302 | struct ti_ohci *ohci; | 2290 | struct ti_ohci *ohci; |
2303 | int id = host->id; | 2291 | int id = host->id; |