Displaying 20 results from an estimated 75 matches for "ida_simple_get".
2011 Oct 30
2
[PATCHv4] virtio-blk: use ida to allocate disk index
...we'll run out of numbers
after a while. It also could cause confusion about the disk
name in the case of hot-plugging disks.
Change virtio-blk to use ida to allocate index, instead.
Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
---
Changes from Mark's versions:
use the new ida_simple_get
error handling cleanup
fix user after free
Works fine for me.
Jens, could you merge this for 3.2?
That is, unless Rusty complains shortly ...
drivers/block/virtio_blk.c | 30 ++++++++++++++++++++++++------
1 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/drivers/block/virtio_...
2011 Oct 30
2
[PATCHv4] virtio-blk: use ida to allocate disk index
...we'll run out of numbers
after a while. It also could cause confusion about the disk
name in the case of hot-plugging disks.
Change virtio-blk to use ida to allocate index, instead.
Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
---
Changes from Mark's versions:
use the new ida_simple_get
error handling cleanup
fix user after free
Works fine for me.
Jens, could you merge this for 3.2?
That is, unless Rusty complains shortly ...
drivers/block/virtio_blk.c | 30 ++++++++++++++++++++++++------
1 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/drivers/block/virtio_...
2017 Dec 20
2
[PATCH v4 1/4] virtio: split device_register into device_initialize and device_add
..._register
> into device_initialize and device_add. device_initialize always sucess,
s/success/succeeds/
> the caller can always use put_device when fail to register virtio_device
"so the caller can always use put_device when register_virtio_device
failed,"
> no matter fail at ida_simple_get or at device_add.
"no matter whether it failed..."
>
> Signed-off-by: weiping zhang <zhangweiping at didichuxing.com>
> Suggested-by: Cornelia Huck <cohuck at redhat.com>
> ---
> drivers/virtio/virtio.c | 18 +++++++++++++++---
> 1 file changed, 15 insert...
2017 Dec 20
2
[PATCH v4 1/4] virtio: split device_register into device_initialize and device_add
..._register
> into device_initialize and device_add. device_initialize always sucess,
s/success/succeeds/
> the caller can always use put_device when fail to register virtio_device
"so the caller can always use put_device when register_virtio_device
failed,"
> no matter fail at ida_simple_get or at device_add.
"no matter whether it failed..."
>
> Signed-off-by: weiping zhang <zhangweiping at didichuxing.com>
> Suggested-by: Cornelia Huck <cohuck at redhat.com>
> ---
> drivers/virtio/virtio.c | 18 +++++++++++++++---
> 1 file changed, 15 insert...
2017 Dec 20
0
[PATCH v4 1/4] virtio: split device_register into device_initialize and device_add
In order to make caller do a simple cleanup, we split device_register
into device_initialize and device_add. device_initialize always sucess,
the caller can always use put_device when fail to register virtio_device
no matter fail at ida_simple_get or at device_add.
Signed-off-by: weiping zhang <zhangweiping at didichuxing.com>
Suggested-by: Cornelia Huck <cohuck at redhat.com>
---
drivers/virtio/virtio.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/virtio/virtio.c b/drivers/vir...
2020 Mar 04
1
[PATCH V5 3/5] vDPA: introduce vDPA bus
...t; + const struct vdpa_config_ops *config)
> +{
> + struct vdpa_device *vdev;
> + int err = -ENOMEM;
> +
> + if (!parent || !dma_dev || !config)
> + goto err;
> +
> + vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
> + if (!vdev)
> + goto err;
> +
> + err = ida_simple_get(&vdpa_index_ida, 0, 0, GFP_KERNEL);
> + if (err < 0)
> + goto err_ida;
> +
> + vdev->dev.bus = &vdpa_bus;
> + vdev->dev.parent = parent;
> + vdev->dev.release = vdpa_release_dev;
> +
> + device_initialize(&vdev->dev);
> +
> + vdev->index...
2015 May 08
2
[patch] virtio_console: use snprintf() for safety
My static checker complains that this sprintf() can overflow.
vdev->index is selected by ida_simple_get() in register_virtio_device()
so my reading of the code is that this overflow is theoretically
possible. The max value of "id" is configurable and I'm not sure what
typical values are.
Anyway, it's simple enough to make the buffer larger and I changed it to
snprintf() as well....
2015 May 08
2
[patch] virtio_console: use snprintf() for safety
My static checker complains that this sprintf() can overflow.
vdev->index is selected by ida_simple_get() in register_virtio_device()
so my reading of the code is that this overflow is theoretically
possible. The max value of "id" is configurable and I'm not sure what
typical values are.
Anyway, it's simple enough to make the buffer larger and I changed it to
snprintf() as well....
2012 May 03
1
[PATCH 2/2] virtio: Use ida to allocate virtio index
...tatic ssize_t device_show(struct device *_d,
struct device_attribute *attr, char *buf)
@@ -193,7 +194,11 @@ int register_virtio_device(struct virtio_device *dev)
dev->dev.bus = &virtio_bus;
/* Assign a unique device index and hence name. */
- dev->index = dev_index++;
+ err = ida_simple_get(&virtio_index_ida, 0, 0, GFP_KERNEL);
+ if (err < 0)
+ goto out;
+
+ dev->index = err;
dev_set_name(&dev->dev, "virtio%u", dev->index);
/* We always start by resetting the device, in case a previous
@@ -208,6 +213,7 @@ int register_virtio_device(struct virtio_de...
2012 May 03
1
[PATCH 2/2] virtio: Use ida to allocate virtio index
...tatic ssize_t device_show(struct device *_d,
struct device_attribute *attr, char *buf)
@@ -193,7 +194,11 @@ int register_virtio_device(struct virtio_device *dev)
dev->dev.bus = &virtio_bus;
/* Assign a unique device index and hence name. */
- dev->index = dev_index++;
+ err = ida_simple_get(&virtio_index_ida, 0, 0, GFP_KERNEL);
+ if (err < 0)
+ goto out;
+
+ dev->index = err;
dev_set_name(&dev->dev, "virtio%u", dev->index);
/* We always start by resetting the device, in case a previous
@@ -208,6 +213,7 @@ int register_virtio_device(struct virtio_de...
2017 Dec 20
8
[PATCH v4 0/4] use put_device to cleanup resource
Hi,
The main change is split device_register into 2 sperate calls:
device_initalize() and device_add, and then the caller can use
put_device safety when fail to register_virtio_device.
v3->v4:
* split device_register into device_initialize and devicea_add that
the caller can always use put_device when fail to register virtio
device.
v2->v3:
* virtio: add new helper do get
2017 Dec 20
8
[PATCH v4 0/4] use put_device to cleanup resource
Hi,
The main change is split device_register into 2 sperate calls:
device_initalize() and device_add, and then the caller can use
put_device safety when fail to register_virtio_device.
v3->v4:
* split device_register into device_initialize and devicea_add that
the caller can always use put_device when fail to register virtio
device.
v2->v3:
* virtio: add new helper do get
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:
2015 May 08
0
[patch] virtio_console: use snprintf() for safety
On (Fri) 08 May 2015 [09:19:02], Dan Carpenter wrote:
> My static checker complains that this sprintf() can overflow.
>
> vdev->index is selected by ida_simple_get() in register_virtio_device()
> so my reading of the code is that this overflow is theoretically
> possible. The max value of "id" is configurable and I'm not sure what
> typical values are.
vdev->index is per-device, and starts with 0 for the first attached
virtio-seria...
2017 Dec 21
0
[PATCH v4 1/4] virtio: split device_register into device_initialize and device_add
...nd device_add. device_initialize always sucess,
>
> s/success/succeeds/
>
>> the caller can always use put_device when fail to register virtio_device
>
> "so the caller can always use put_device when register_virtio_device
> failed,"
>
>> no matter fail at ida_simple_get or at device_add.
>
> "no matter whether it failed..."
>
>> + *
>> + * If an error occurs, the caller must use put_device, instead of kfree, because
>> + * device_initialize and device_add will increase @dev->dev's reference count.
>
> That's no...
2017 Dec 21
1
[PATCH v5 1/4] virtio: split device_register into device_initialize and device_add
...have obtained a reference to @dev.
+ *
+ * Returns: 0 on suceess, -error on failure
+ */
int register_virtio_device(struct virtio_device *dev)
{
int err;
dev->dev.bus = &virtio_bus;
+ device_initialize(&dev->dev);
/* Assign a unique device index and hence name. */
err = ida_simple_get(&virtio_index_ida, 0, 0, GFP_KERNEL);
@@ -330,9 +340,11 @@ int register_virtio_device(struct virtio_device *dev)
INIT_LIST_HEAD(&dev->vqs);
- /* device_register() causes the bus infrastructure to look for a
- * matching driver. */
- err = device_register(&dev->dev);
+ /*
+...
2020 Apr 14
0
[PATCH v2 09/33] iommu: Keep a list of allocated groups in __iommu_probe_device()
...from the
@@ -567,6 +571,7 @@ struct iommu_group *iommu_group_alloc(void)
group->kobj.kset = iommu_group_kset;
mutex_init(&group->mutex);
INIT_LIST_HEAD(&group->devices);
+ INIT_LIST_HEAD(&group->entry);
BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier);
ret = ida_simple_get(&iommu_group_ida, 0, 0, GFP_KERNEL);
--
2.17.1
2015 Jan 13
0
[PATCH 2/6] virtio/blk: verify device has config space
...@@ -575,6 +575,12 @@ static int virtblk_probe(struct virtio_device *vdev)
u16 min_io_size;
u8 physical_block_exp, alignment_offset;
+ if (!vdev->config->get) {
+ dev_err(&vdev->dev, "%s failure: config access disabled\n",
+ __func__);
+ return -EINVAL;
+ }
+
err = ida_simple_get(&vd_index_ida, 0, minor_to_index(1 << MINORBITS),
GFP_KERNEL);
if (err < 0)
--
MST
2016 Nov 13
1
[PATCH v3 1/2] nouveau/bl: Assign different names to interfaces
...ida bl_ida;
+#define BL_NAME_SIZE 15 // 12 for name + 2 for digits + 1 for '\0'
+
+struct backlight_connector {
+ struct list_head head;
+ int id;
+};
+
+static void
+nouveau_get_backlight_name(char backlight_name[BL_NAME_SIZE], struct
+ backlight_connector *connector)
+{
+ const int nb = ida_simple_get(&bl_ida, 0, 0, GFP_KERNEL);
+ if (nb > 0 && nb < 100)
+ snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb);
+ else
+ snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight");
+ connector->id = nb;
+}
+
static int
nv40_get_intensity(struct backlig...
2016 Apr 15
11
[PATCH 1/2] nouveau/bl: Assign different names to interfaces
Currently, every backlight interface created by Nouveau uses the same name,
nv_backlight. This leads to a sysfs warning as it tries to create an already
existing folder. This patch adds a incremented number to the name, but keeps
the initial name as nv_backlight, to avoid possibly breaking userspace; the
second interface will be named nv_backlight1, and so on.
Fixes: fdo#86539
Signed-off-by: