search for: ida_simple_remove

Displaying 20 results from an estimated 140 matches for "ida_simple_remove".

2012 Nov 08
3
[PATCH] virtio: Don't access index after unregister.
...ference with device_unregister(), making accessing dev->index afterwards invalid. I actually saw problems when testing my (not-yet-merged) virtio-ccw code: - device_add virtio-net,id=xxx -> creates device virtio<n> with n>0 - device_del xxx -> deletes virtio<n>, but calls ida_simple_remove with an index of 0 - device_add virtio-net,id=xxx -> tries to add virtio0, which is still in use... So let's save the index we want to release before calling device_unregister(). Signed-off-by: Cornelia Huck <cornelia.huck at de.ibm.com> --- drivers/virtio/virtio.c | 4 +++- 1 f...
2012 Nov 08
3
[PATCH] virtio: Don't access index after unregister.
...ference with device_unregister(), making accessing dev->index afterwards invalid. I actually saw problems when testing my (not-yet-merged) virtio-ccw code: - device_add virtio-net,id=xxx -> creates device virtio<n> with n>0 - device_del xxx -> deletes virtio<n>, but calls ida_simple_remove with an index of 0 - device_add virtio-net,id=xxx -> tries to add virtio0, which is still in use... So let's save the index we want to release before calling device_unregister(). Signed-off-by: Cornelia Huck <cornelia.huck at de.ibm.com> --- drivers/virtio/virtio.c | 4 +++- 1 f...
2020 Feb 11
2
[PATCH V2 3/5] vDPA: introduce vDPA bus
...vdpa device to be registered to vDPA bus > + * > + * Returns an error when fail to add to vDPA bus > + */ > +int vdpa_register_device(struct vdpa_device *vdev) > +{ > + int err = device_add(&vdev->dev); > + > + if (err) { > + put_device(&vdev->dev); > + ida_simple_remove(&vdpa_index_ida, vdev->index); > + } This is a very dangerous construction, I've seen it lead to driver bugs. Better to require the driver to always do the put_device on error unwind The ida_simple_remove should probably be part of the class release function to make everything work...
2020 Feb 11
2
[PATCH V2 3/5] vDPA: introduce vDPA bus
...vdpa device to be registered to vDPA bus > + * > + * Returns an error when fail to add to vDPA bus > + */ > +int vdpa_register_device(struct vdpa_device *vdev) > +{ > + int err = device_add(&vdev->dev); > + > + if (err) { > + put_device(&vdev->dev); > + ida_simple_remove(&vdpa_index_ida, vdev->index); > + } This is a very dangerous construction, I've seen it lead to driver bugs. Better to require the driver to always do the put_device on error unwind The ida_simple_remove should probably be part of the class release function to make everything work...
2018 Aug 23
1
[PATCH 1/5] drm/nouveau: Check backlight IDs are >= 0, not > 0
...16,7 @@ nv40_backlight_init(struct drm_connector *connector) > &nv40_bl_ops, &props); > > if (IS_ERR(bd)) { > - if (bl_connector.id > 0) > + if (bl_connector.id >= 0) > ida_simple_remove(&bl_ida, bl_connector.id); > return PTR_ERR(bd); > } > @@ -249,7 +249,7 @@ nv50_backlight_init(struct drm_connector *connector) > nv_encoder, ops, &props); > > if (IS_ERR(bd)) { > - if...
2014 Jul 21
3
[PATCH v2 3/4] virtio: rng: delay hwrng_register() till driver is ready
...static bool probe_done; > @@ -136,15 +137,6 @@ static int probe_common(struct virtio_device *vdev) > return err; > } > > - err = hwrng_register(&vi->hwrng); > - if (err) { > - vdev->config->del_vqs(vdev); > - vi->vq = NULL; > - kfree(vi); > - ida_simple_remove(&rng_index_ida, index); > - return err; > - } > - This needs to stay. register, and failure to do so, should occur in the probe routine. > probe_done = true; > return 0; > } > @@ -152,9 +144,11 @@ static int probe_common(struct virtio_device *vdev) > static voi...
2014 Jul 21
3
[PATCH v2 3/4] virtio: rng: delay hwrng_register() till driver is ready
...static bool probe_done; > @@ -136,15 +137,6 @@ static int probe_common(struct virtio_device *vdev) > return err; > } > > - err = hwrng_register(&vi->hwrng); > - if (err) { > - vdev->config->del_vqs(vdev); > - vi->vq = NULL; > - kfree(vi); > - ida_simple_remove(&rng_index_ida, index); > - return err; > - } > - This needs to stay. register, and failure to do so, should occur in the probe routine. > probe_done = true; > return 0; > } > @@ -152,9 +144,11 @@ static int probe_common(struct virtio_device *vdev) > static voi...
2018 Aug 23
6
[PATCH 0/5] drm/nouveau: Backlight fixes and cleanup
This series fixes some issues with nouveau's backlight support that were causing kernel panics on module reloads, specifically on systems with nouveau handling the backlight of one of the displays. While we're at it, let's cleanup nouveau_backlight.c as well Lyude Paul (5): drm/nouveau: Check backlight IDs are >= 0, not > 0 drm/nouveau: Move backlight device into
2012 Dec 19
2
[PATCH] virtio-blk: Don't free ida when disk is in use
...tic void __devexit virtblk_remove(struct virtio_device *vdev) flush_work(&vblk->config_work); + refc = atomic_read(&disk_to_dev(vblk->disk)->kobj.kref.refcount); put_disk(vblk->disk); mempool_destroy(vblk->pool); vdev->config->del_vqs(vdev); kfree(vblk); - ida_simple_remove(&vd_index_ida, index); + + /* Only free device id if we don't have any users */ + if (refc == 1) + ida_simple_remove(&vd_index_ida, index); } #ifdef CONFIG_PM -- 1.7.12.4
2012 Dec 19
2
[PATCH] virtio-blk: Don't free ida when disk is in use
...tic void __devexit virtblk_remove(struct virtio_device *vdev) flush_work(&vblk->config_work); + refc = atomic_read(&disk_to_dev(vblk->disk)->kobj.kref.refcount); put_disk(vblk->disk); mempool_destroy(vblk->pool); vdev->config->del_vqs(vdev); kfree(vblk); - ida_simple_remove(&vd_index_ida, index); + + /* Only free device id if we don't have any users */ + if (refc == 1) + ida_simple_remove(&vd_index_ida, index); } #ifdef CONFIG_PM -- 1.7.12.4
2017 Nov 29
3
[PATCH] virtio: release virtio index when fail to device_register
.....bf7ff39 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -333,6 +333,8 @@ int register_virtio_device(struct virtio_device *dev) /* device_register() causes the bus infrastructure to look for a * matching driver. */ err = device_register(&dev->dev); + if (err) + ida_simple_remove(&virtio_index_ida, dev->index); out: if (err) virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED); -- 2.9.4
2017 Nov 29
3
[PATCH] virtio: release virtio index when fail to device_register
.....bf7ff39 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -333,6 +333,8 @@ int register_virtio_device(struct virtio_device *dev) /* device_register() causes the bus infrastructure to look for a * matching driver. */ err = device_register(&dev->dev); + if (err) + ida_simple_remove(&virtio_index_ida, dev->index); out: if (err) virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED); -- 2.9.4
2018 Aug 29
5
[PATCH v2 0/5] drm/nouveau: Backlight fixes and cleanup
Next version of https://patchwork.freedesktop.org/series/48596/ . Made some important changes to the refactoring patch, but everything else is the same. Lyude Paul (5): drm/nouveau: Check backlight IDs are >= 0, not > 0 drm/nouveau: Move backlight device into nouveau_connector drm/nouveau: s/nouveau_backlight_exit/nouveau_backlight_fini/ drm/nouveau: Cleanup indenting in
2018 Aug 29
6
[PATCH RESEND v3 0/6] drm/nouveau: Backlight fixes and cleanup
Forgot to send 6 patches instead of five since there's one new one now, whoops! No actual changes, next version of https://patchwork.freedesktop.org/series/48596/ Lyude Paul (6): drm/nouveau: Check backlight IDs are >= 0, not > 0 drm/nouveau: Add NV_PRINTK_ONCE and variants drm/nouveau: Move backlight device into nouveau_connector drm/nouveau:
2016 Nov 13
1
[PATCH v3 1/2] nouveau/bl: Assign different names to interfaces
...backlight", connector->kdev, drm, + nouveau_get_backlight_name(backlight_name, &bl_connector); + bd = backlight_device_register(backlight_name , connector->kdev, drm, &nv40_bl_ops, &props); - if (IS_ERR(bd)) + + if (IS_ERR(bd)) { + if (bl_connector.id > 0) + ida_simple_remove(&bl_ida, bl_connector.id); return PTR_ERR(bd); + } + list_add(&bl_connector.head, &drm->bl_connectors); drm->backlight = bd; bd->props.brightness = nv40_get_intensity(bd); backlight_update_status(bd); @@ -182,6 +211,8 @@ nv50_backlight_init(struct drm_connector *connec...
2018 Jul 05
4
[PATCH 0/2] drm/nouveau: Fix panic on nouveau unload.
If have a couple patches I found while looking at a panic I was seeing while unloading the nouveau module. Unloading the nouveau module on my optimus notebook machine causes the system to panic. This started occuring when moving from 4.4 to 4.14. These patches make it such that the system does not panic when unloading the module. 4.14 also requires commit 34112bf4935d ("drm/nouveau/fbcon:
2018 Sep 06
7
[PATCH v4 0/6] Backlight fixes and cleanup
Refactor for Ben, hopefully this time this should apply to his tree. Next version of https://patchwork.freedesktop.org/series/48596/ No changes otherwise. Lyude Paul (6): drm/nouveau: Check backlight IDs are >= 0, not > 0 drm/nouveau: Add NV_PRINTK_ONCE and variants drm/nouveau: Move backlight device into nouveau_connector drm/nouveau:
2014 Aug 12
3
[3.16 stable PATCH v2 1/2] virtio: rng: delay hwrng_register() till driver is ready
...; int index; + bool hwrng_register_done; }; static bool probe_done; @@ -137,15 +138,6 @@ static int probe_common(struct virtio_device *vdev) return err; } - err = hwrng_register(&vi->hwrng); - if (err) { - vdev->config->del_vqs(vdev); - vi->vq = NULL; - kfree(vi); - ida_simple_remove(&rng_index_ida, index); - return err; - } - probe_done = true; return 0; } @@ -153,9 +145,11 @@ static int probe_common(struct virtio_device *vdev) static void remove_common(struct virtio_device *vdev) { struct virtrng_info *vi = vdev->priv; + vdev->config->reset(vdev); v...
2014 Aug 12
3
[3.16 stable PATCH v2 1/2] virtio: rng: delay hwrng_register() till driver is ready
...; int index; + bool hwrng_register_done; }; static bool probe_done; @@ -137,15 +138,6 @@ static int probe_common(struct virtio_device *vdev) return err; } - err = hwrng_register(&vi->hwrng); - if (err) { - vdev->config->del_vqs(vdev); - vi->vq = NULL; - kfree(vi); - ida_simple_remove(&rng_index_ida, index); - return err; - } - probe_done = true; return 0; } @@ -153,9 +145,11 @@ static int probe_common(struct virtio_device *vdev) static void remove_common(struct virtio_device *vdev) { struct virtrng_info *vi = vdev->priv; + vdev->config->reset(vdev); v...
2018 Aug 29
5
[PATCH v3 0/5] drm/nouveau: Backlight fixes and cleanup
Next version of https://patchwork.freedesktop.org/series/48596/ . Added NV_INFO_ONCE and made "Move backlight device into nouveau_connector" use that instead so we don't print the GMUX warning more then once. Lyude Paul (5): drm/nouveau: Add NV_PRINTK_ONCE and variants drm/nouveau: Move backlight device into nouveau_connector drm/nouveau: