Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 1 | /* |
| 2 | * V4L2 asynchronous subdevice registration API |
| 3 | * |
| 4 | * Copyright (C) 2012-2013, Guennadi Liakhovetski <g.liakhovetski@gmx.de> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/device.h> |
| 12 | #include <linux/err.h> |
| 13 | #include <linux/i2c.h> |
| 14 | #include <linux/list.h> |
| 15 | #include <linux/module.h> |
| 16 | #include <linux/mutex.h> |
| 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/slab.h> |
| 19 | #include <linux/types.h> |
| 20 | |
| 21 | #include <media/v4l2-async.h> |
| 22 | #include <media/v4l2-device.h> |
| 23 | #include <media/v4l2-subdev.h> |
| 24 | |
Sakari Ailus | 8621765 | 2015-06-11 12:18:01 -0700 | [diff] [blame] | 25 | static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 26 | { |
Guennadi Liakhovetski | fe05e14 | 2013-06-24 05:13:51 -0300 | [diff] [blame] | 27 | #if IS_ENABLED(CONFIG_I2C) |
Sakari Ailus | 8621765 | 2015-06-11 12:18:01 -0700 | [diff] [blame] | 28 | struct i2c_client *client = i2c_verify_client(sd->dev); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 29 | return client && |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 30 | asd->match.i2c.adapter_id == client->adapter->nr && |
| 31 | asd->match.i2c.address == client->addr; |
Guennadi Liakhovetski | fe05e14 | 2013-06-24 05:13:51 -0300 | [diff] [blame] | 32 | #else |
| 33 | return false; |
| 34 | #endif |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 35 | } |
| 36 | |
Sakari Ailus | 8621765 | 2015-06-11 12:18:01 -0700 | [diff] [blame] | 37 | static bool match_devname(struct v4l2_subdev *sd, |
| 38 | struct v4l2_async_subdev *asd) |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 39 | { |
Sakari Ailus | 8621765 | 2015-06-11 12:18:01 -0700 | [diff] [blame] | 40 | return !strcmp(asd->match.device_name.name, dev_name(sd->dev)); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 41 | } |
| 42 | |
Sakari Ailus | 8621765 | 2015-06-11 12:18:01 -0700 | [diff] [blame] | 43 | static bool match_of(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) |
Sylwester Nawrocki | e7359f8 | 2013-07-19 12:21:29 -0300 | [diff] [blame] | 44 | { |
Sakari Ailus | 8621765 | 2015-06-11 12:18:01 -0700 | [diff] [blame] | 45 | return sd->of_node == asd->match.of.node; |
| 46 | } |
| 47 | |
| 48 | static bool match_custom(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) |
| 49 | { |
| 50 | if (!asd->match.custom.match) |
| 51 | /* Match always */ |
| 52 | return true; |
| 53 | |
| 54 | return asd->match.custom.match(sd->dev, asd); |
Sylwester Nawrocki | e7359f8 | 2013-07-19 12:21:29 -0300 | [diff] [blame] | 55 | } |
| 56 | |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 57 | static LIST_HEAD(subdev_list); |
| 58 | static LIST_HEAD(notifier_list); |
| 59 | static DEFINE_MUTEX(list_lock); |
| 60 | |
| 61 | static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier *notifier, |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 62 | struct v4l2_subdev *sd) |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 63 | { |
Sakari Ailus | 8621765 | 2015-06-11 12:18:01 -0700 | [diff] [blame] | 64 | bool (*match)(struct v4l2_subdev *, struct v4l2_async_subdev *); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 65 | struct v4l2_async_subdev *asd; |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 66 | |
| 67 | list_for_each_entry(asd, ¬ifier->waiting, list) { |
| 68 | /* bus_type has been verified valid before */ |
Sylwester Nawrocki | cfca764 | 2013-07-19 12:14:46 -0300 | [diff] [blame] | 69 | switch (asd->match_type) { |
| 70 | case V4L2_ASYNC_MATCH_CUSTOM: |
Sakari Ailus | 8621765 | 2015-06-11 12:18:01 -0700 | [diff] [blame] | 71 | match = match_custom; |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 72 | break; |
Sylwester Nawrocki | cfca764 | 2013-07-19 12:14:46 -0300 | [diff] [blame] | 73 | case V4L2_ASYNC_MATCH_DEVNAME: |
| 74 | match = match_devname; |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 75 | break; |
Sylwester Nawrocki | cfca764 | 2013-07-19 12:14:46 -0300 | [diff] [blame] | 76 | case V4L2_ASYNC_MATCH_I2C: |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 77 | match = match_i2c; |
| 78 | break; |
Sylwester Nawrocki | e7359f8 | 2013-07-19 12:21:29 -0300 | [diff] [blame] | 79 | case V4L2_ASYNC_MATCH_OF: |
| 80 | match = match_of; |
| 81 | break; |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 82 | default: |
| 83 | /* Cannot happen, unless someone breaks us */ |
| 84 | WARN_ON(true); |
| 85 | return NULL; |
| 86 | } |
| 87 | |
| 88 | /* match cannot be NULL here */ |
Sakari Ailus | 8621765 | 2015-06-11 12:18:01 -0700 | [diff] [blame] | 89 | if (match(sd, asd)) |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 90 | return asd; |
| 91 | } |
| 92 | |
| 93 | return NULL; |
| 94 | } |
| 95 | |
| 96 | static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier, |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 97 | struct v4l2_subdev *sd, |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 98 | struct v4l2_async_subdev *asd) |
| 99 | { |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 100 | int ret; |
| 101 | |
| 102 | /* Remove from the waiting list */ |
| 103 | list_del(&asd->list); |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 104 | sd->asd = asd; |
| 105 | sd->notifier = notifier; |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 106 | |
| 107 | if (notifier->bound) { |
| 108 | ret = notifier->bound(notifier, sd, asd); |
| 109 | if (ret < 0) |
| 110 | return ret; |
| 111 | } |
| 112 | /* Move from the global subdevice list to notifier's done */ |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 113 | list_move(&sd->async_list, ¬ifier->done); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 114 | |
| 115 | ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd); |
| 116 | if (ret < 0) { |
| 117 | if (notifier->unbind) |
| 118 | notifier->unbind(notifier, sd, asd); |
| 119 | return ret; |
| 120 | } |
| 121 | |
Javier Martinez Canillas | 7c3e1ec | 2016-02-05 17:09:52 -0200 | [diff] [blame] | 122 | ret = v4l2_subdev_call(sd, core, registered_async); |
Javier Martinez Canillas | c574b75 | 2016-02-16 18:03:21 -0200 | [diff] [blame] | 123 | if (ret < 0 && ret != -ENOIOCTLCMD) { |
Javier Martinez Canillas | 7c3e1ec | 2016-02-05 17:09:52 -0200 | [diff] [blame] | 124 | if (notifier->unbind) |
| 125 | notifier->unbind(notifier, sd, asd); |
| 126 | return ret; |
| 127 | } |
| 128 | |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 129 | if (list_empty(¬ifier->waiting) && notifier->complete) |
| 130 | return notifier->complete(notifier); |
| 131 | |
| 132 | return 0; |
| 133 | } |
| 134 | |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 135 | static void v4l2_async_cleanup(struct v4l2_subdev *sd) |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 136 | { |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 137 | v4l2_device_unregister_subdev(sd); |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 138 | /* Subdevice driver will reprobe and put the subdev back onto the list */ |
| 139 | list_del_init(&sd->async_list); |
| 140 | sd->asd = NULL; |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 141 | sd->dev = NULL; |
| 142 | } |
| 143 | |
| 144 | int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev, |
| 145 | struct v4l2_async_notifier *notifier) |
| 146 | { |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 147 | struct v4l2_subdev *sd, *tmp; |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 148 | struct v4l2_async_subdev *asd; |
| 149 | int i; |
| 150 | |
| 151 | if (!notifier->num_subdevs || notifier->num_subdevs > V4L2_MAX_SUBDEVS) |
| 152 | return -EINVAL; |
| 153 | |
| 154 | notifier->v4l2_dev = v4l2_dev; |
| 155 | INIT_LIST_HEAD(¬ifier->waiting); |
| 156 | INIT_LIST_HEAD(¬ifier->done); |
| 157 | |
| 158 | for (i = 0; i < notifier->num_subdevs; i++) { |
Sylwester Nawrocki | e8419d0 | 2013-07-19 12:31:10 -0300 | [diff] [blame] | 159 | asd = notifier->subdevs[i]; |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 160 | |
Sylwester Nawrocki | cfca764 | 2013-07-19 12:14:46 -0300 | [diff] [blame] | 161 | switch (asd->match_type) { |
| 162 | case V4L2_ASYNC_MATCH_CUSTOM: |
| 163 | case V4L2_ASYNC_MATCH_DEVNAME: |
| 164 | case V4L2_ASYNC_MATCH_I2C: |
Sylwester Nawrocki | e7359f8 | 2013-07-19 12:21:29 -0300 | [diff] [blame] | 165 | case V4L2_ASYNC_MATCH_OF: |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 166 | break; |
| 167 | default: |
| 168 | dev_err(notifier->v4l2_dev ? notifier->v4l2_dev->dev : NULL, |
Sylwester Nawrocki | cfca764 | 2013-07-19 12:14:46 -0300 | [diff] [blame] | 169 | "Invalid match type %u on %p\n", |
| 170 | asd->match_type, asd); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 171 | return -EINVAL; |
| 172 | } |
| 173 | list_add_tail(&asd->list, ¬ifier->waiting); |
| 174 | } |
| 175 | |
| 176 | mutex_lock(&list_lock); |
| 177 | |
| 178 | /* Keep also completed notifiers on the list */ |
| 179 | list_add(¬ifier->list, ¬ifier_list); |
| 180 | |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 181 | list_for_each_entry_safe(sd, tmp, &subdev_list, async_list) { |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 182 | int ret; |
| 183 | |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 184 | asd = v4l2_async_belongs(notifier, sd); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 185 | if (!asd) |
| 186 | continue; |
| 187 | |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 188 | ret = v4l2_async_test_notify(notifier, sd, asd); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 189 | if (ret < 0) { |
| 190 | mutex_unlock(&list_lock); |
| 191 | return ret; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | mutex_unlock(&list_lock); |
| 196 | |
| 197 | return 0; |
| 198 | } |
| 199 | EXPORT_SYMBOL(v4l2_async_notifier_register); |
| 200 | |
| 201 | void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) |
| 202 | { |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 203 | struct v4l2_subdev *sd, *tmp; |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 204 | unsigned int notif_n_subdev = notifier->num_subdevs; |
| 205 | unsigned int n_subdev = min(notif_n_subdev, V4L2_MAX_SUBDEVS); |
Mauro Carvalho Chehab | 24e9a47 | 2013-11-02 06:20:16 -0300 | [diff] [blame] | 206 | struct device **dev; |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 207 | int i = 0; |
| 208 | |
Laurent Pinchart | 8e3fbfe | 2013-07-03 07:49:06 -0300 | [diff] [blame] | 209 | if (!notifier->v4l2_dev) |
| 210 | return; |
| 211 | |
Mauro Carvalho Chehab | 24e9a47 | 2013-11-02 06:20:16 -0300 | [diff] [blame] | 212 | dev = kmalloc(n_subdev * sizeof(*dev), GFP_KERNEL); |
| 213 | if (!dev) { |
| 214 | dev_err(notifier->v4l2_dev->dev, |
| 215 | "Failed to allocate device cache!\n"); |
| 216 | } |
| 217 | |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 218 | mutex_lock(&list_lock); |
| 219 | |
| 220 | list_del(¬ifier->list); |
| 221 | |
Sylwester Nawrocki | ceedcc4 | 2013-07-31 13:10:18 -0300 | [diff] [blame] | 222 | list_for_each_entry_safe(sd, tmp, ¬ifier->done, async_list) { |
Mauro Carvalho Chehab | 24e9a47 | 2013-11-02 06:20:16 -0300 | [diff] [blame] | 223 | struct device *d; |
| 224 | |
| 225 | d = get_device(sd->dev); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 226 | |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 227 | v4l2_async_cleanup(sd); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 228 | |
| 229 | /* If we handled USB devices, we'd have to lock the parent too */ |
Mauro Carvalho Chehab | 24e9a47 | 2013-11-02 06:20:16 -0300 | [diff] [blame] | 230 | device_release_driver(d); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 231 | |
| 232 | if (notifier->unbind) |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 233 | notifier->unbind(notifier, sd, sd->asd); |
Mauro Carvalho Chehab | 24e9a47 | 2013-11-02 06:20:16 -0300 | [diff] [blame] | 234 | |
| 235 | /* |
| 236 | * Store device at the device cache, in order to call |
| 237 | * put_device() on the final step |
| 238 | */ |
| 239 | if (dev) |
| 240 | dev[i++] = d; |
| 241 | else |
| 242 | put_device(d); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | mutex_unlock(&list_lock); |
| 246 | |
Mauro Carvalho Chehab | 24e9a47 | 2013-11-02 06:20:16 -0300 | [diff] [blame] | 247 | /* |
| 248 | * Call device_attach() to reprobe devices |
| 249 | * |
| 250 | * NOTE: If dev allocation fails, i is 0, and the whole loop won't be |
| 251 | * executed. |
| 252 | */ |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 253 | while (i--) { |
| 254 | struct device *d = dev[i]; |
| 255 | |
| 256 | if (d && device_attach(d) < 0) { |
| 257 | const char *name = "(none)"; |
| 258 | int lock = device_trylock(d); |
| 259 | |
| 260 | if (lock && d->driver) |
| 261 | name = d->driver->name; |
| 262 | dev_err(d, "Failed to re-probe to %s\n", name); |
| 263 | if (lock) |
| 264 | device_unlock(d); |
| 265 | } |
| 266 | put_device(d); |
| 267 | } |
Mauro Carvalho Chehab | 24e9a47 | 2013-11-02 06:20:16 -0300 | [diff] [blame] | 268 | kfree(dev); |
Laurent Pinchart | 8e3fbfe | 2013-07-03 07:49:06 -0300 | [diff] [blame] | 269 | |
| 270 | notifier->v4l2_dev = NULL; |
| 271 | |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 272 | /* |
| 273 | * Don't care about the waiting list, it is initialised and populated |
| 274 | * upon notifier registration. |
| 275 | */ |
| 276 | } |
| 277 | EXPORT_SYMBOL(v4l2_async_notifier_unregister); |
| 278 | |
| 279 | int v4l2_async_register_subdev(struct v4l2_subdev *sd) |
| 280 | { |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 281 | struct v4l2_async_notifier *notifier; |
| 282 | |
Sakari Ailus | 8621765 | 2015-06-11 12:18:01 -0700 | [diff] [blame] | 283 | /* |
| 284 | * No reference taken. The reference is held by the device |
| 285 | * (struct v4l2_subdev.dev), and async sub-device does not |
| 286 | * exist independently of the device at any point of time. |
| 287 | */ |
| 288 | if (!sd->of_node && sd->dev) |
| 289 | sd->of_node = sd->dev->of_node; |
| 290 | |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 291 | mutex_lock(&list_lock); |
| 292 | |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 293 | INIT_LIST_HEAD(&sd->async_list); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 294 | |
| 295 | list_for_each_entry(notifier, ¬ifier_list, list) { |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 296 | struct v4l2_async_subdev *asd = v4l2_async_belongs(notifier, sd); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 297 | if (asd) { |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 298 | int ret = v4l2_async_test_notify(notifier, sd, asd); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 299 | mutex_unlock(&list_lock); |
| 300 | return ret; |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | /* None matched, wait for hot-plugging */ |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 305 | list_add(&sd->async_list, &subdev_list); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 306 | |
| 307 | mutex_unlock(&list_lock); |
| 308 | |
| 309 | return 0; |
| 310 | } |
| 311 | EXPORT_SYMBOL(v4l2_async_register_subdev); |
| 312 | |
| 313 | void v4l2_async_unregister_subdev(struct v4l2_subdev *sd) |
| 314 | { |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 315 | struct v4l2_async_notifier *notifier = sd->notifier; |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 316 | |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 317 | if (!sd->asd) { |
| 318 | if (!list_empty(&sd->async_list)) |
| 319 | v4l2_async_cleanup(sd); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 320 | return; |
| 321 | } |
| 322 | |
| 323 | mutex_lock(&list_lock); |
| 324 | |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 325 | list_add(&sd->asd->list, ¬ifier->waiting); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 326 | |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 327 | v4l2_async_cleanup(sd); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 328 | |
| 329 | if (notifier->unbind) |
Sylwester Nawrocki | b426b3a | 2013-07-22 08:01:33 -0300 | [diff] [blame] | 330 | notifier->unbind(notifier, sd, sd->asd); |
Guennadi Liakhovetski | e9e3104 | 2013-01-08 07:06:31 -0300 | [diff] [blame] | 331 | |
| 332 | mutex_unlock(&list_lock); |
| 333 | } |
| 334 | EXPORT_SYMBOL(v4l2_async_unregister_subdev); |