diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-01-27 07:54:23 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-02-08 15:00:53 -0500 |
commit | 12ba145c9406da72c8288245f352de7f37188f1f (patch) | |
tree | 4c38364fbaa22106a681b894f85480916fd3e0e6 | |
parent | 88e7bf2a4c35d1200c2f72f5cd3d9e72c7f6c890 (diff) |
ieee1394: dv1394: tidy up card removal
small coding style touch-up and terser coding
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r-- | drivers/ieee1394/dv1394.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index d636cfad7fcf..55d6ae664fd6 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -2255,47 +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, found_ohci_card = 0; | 2262 | int found_ohci_card = 0; |
2271 | 2263 | ||
2272 | /* find the corresponding video_cards */ | ||
2273 | do { | 2264 | do { |
2274 | struct video_card *tmp_vid; | ||
2275 | |||
2276 | video = NULL; | 2265 | video = NULL; |
2277 | |||
2278 | spin_lock_irqsave(&dv1394_cards_lock, flags); | 2266 | spin_lock_irqsave(&dv1394_cards_lock, flags); |
2279 | list_for_each_entry(tmp_vid, &dv1394_cards, list) { | 2267 | list_for_each_entry(tmp_video, &dv1394_cards, list) { |
2280 | if ((tmp_vid->id >> 2) == id) { | 2268 | if ((tmp_video->id >> 2) == host->id) { |
2281 | list_del(&tmp_vid->list); | 2269 | list_del(&tmp_video->list); |
2282 | video = tmp_vid; | 2270 | video = tmp_video; |
2283 | found_ohci_card = 1; | 2271 | found_ohci_card = 1; |
2284 | break; | 2272 | break; |
2285 | } | 2273 | } |
2286 | } | 2274 | } |
2287 | spin_unlock_irqrestore(&dv1394_cards_lock, flags); | 2275 | spin_unlock_irqrestore(&dv1394_cards_lock, flags); |
2288 | 2276 | ||
2289 | if (video) | 2277 | if (video) { |
2290 | dv1394_un_init(video); | 2278 | do_dv1394_shutdown(video, 1); |
2291 | } while (video != NULL); | 2279 | kfree(video); |
2280 | } | ||
2281 | } while (video); | ||
2292 | 2282 | ||
2293 | if (found_ohci_card) | 2283 | if (found_ohci_card) |
2294 | class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, | 2284 | class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, |
2295 | IEEE1394_MINOR_BLOCK_DV1394 * 16 + (host->id << 2))); | 2285 | IEEE1394_MINOR_BLOCK_DV1394 * 16 + (host->id << 2))); |
2296 | } | 2286 | } |
2297 | 2287 | ||
2298 | static void dv1394_add_host (struct hpsb_host *host) | 2288 | static void dv1394_add_host(struct hpsb_host *host) |
2299 | { | 2289 | { |
2300 | struct ti_ohci *ohci; | 2290 | struct ti_ohci *ohci; |
2301 | int id = host->id; | 2291 | int id = host->id; |