From: Laura Abbott <labbott@redhat.com>
To: Benjamin Gaignard <benjamin.gaignard@linaro.org>,
sumit.semwal@linaro.org, gregkh@linuxfoundation.org,
arve@android.com, riandrews@android.com, broonie@kernel.org,
dan.carpenter@oracle.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-api@vger.kernel.org
Subject: Re: [PATCH v5 2/2] staging: ion: create one device entry per heap
Date: Wed, 18 Oct 2017 13:07:33 -0700 [thread overview]
Message-ID: <bff3d0c7-110d-d702-165b-855daaca6382@redhat.com> (raw)
In-Reply-To: <1506518409-16887-3-git-send-email-benjamin.gaignard@linaro.org>
On 09/27/2017 06:20 AM, Benjamin Gaignard wrote:
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index 93e2c90..092b24c 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -40,6 +40,8 @@
>
> #include "ion.h"
>
> +#define ION_DEV_MAX 32
> +
> static struct ion_device *internal_dev;
> static int heap_id;
>
> @@ -537,15 +539,28 @@ static int debug_shrink_get(void *data, u64 *val)
> DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, debug_shrink_get,
> debug_shrink_set, "%llu\n");
>
> -void ion_device_add_heap(struct ion_heap *heap)
> +int ion_device_add_heap(struct ion_heap *heap)
> {
> struct dentry *debug_file;
> struct ion_device *dev = internal_dev;
> + int ret = 0;
>
> if (!heap->ops->allocate || !heap->ops->free)
> pr_err("%s: can not add heap with invalid ops struct.\n",
> __func__);
>
> + if (heap_id >= ION_DEV_MAX)
> + return -EBUSY;
> +
> + heap->ddev.devt = MKDEV(MAJOR(dev->devt), heap_id);
> + dev_set_name(&heap->ddev, "ion%d", heap_id);
> + device_initialize(&heap->ddev);
> + cdev_init(&heap->chrdev, &ion_fops);
> + heap->chrdev.owner = THIS_MODULE;
> + ret = cdev_device_add(&heap->chrdev, &heap->ddev);
> + if (ret < 0)
> + return ret;
> +
> spin_lock_init(&heap->free_lock);
> heap->free_list_size = 0;
>
> @@ -583,6 +598,8 @@ void ion_device_add_heap(struct ion_heap *heap)
>
> dev->heap_cnt++;
> up_write(&dev->lock);
> +
> + return ret;
> }
> EXPORT_SYMBOL(ion_device_add_heap);
>
> @@ -595,6 +612,7 @@ static int ion_device_create(void)
> if (!idev)
> return -ENOMEM;
>
> +#ifdef CONFIG_ION_LEGACY_DEVICE_API
> idev->dev.minor = MISC_DYNAMIC_MINOR;
> idev->dev.name = "ion";
> idev->dev.fops = &ion_fops;
> @@ -605,6 +623,17 @@ static int ion_device_create(void)
> kfree(idev);
> return ret;
> }
> +#endif
> +
> + ret = alloc_chrdev_region(&idev->devt, 0, ION_DEV_MAX, "ion");
> + if (ret) {
> + pr_err("ion: unable to allocate device\n");
> +#ifdef CONFIG_ION_LEGACY_DEVICE_API
> + misc_deregister(&idev->dev);
> +#endif
> + kfree(idev);
> + return ret;
> + }
>
> idev->debug_root = debugfs_create_dir("ion", NULL);
> if (!idev->debug_root) {
I'm not 100% sure about the device hierarchy here. We're
ending up with devices at the root of /sys/devices
/sys/devices # ls
breakpoint ion0 ion1 ion2 platform software system virtual
and the Android init system doesn't pick this up. I'll
admit to being out of my area here but I don't think
this looks quite right.
Thanks,
Laura
next prev parent reply other threads:[~2017-10-18 20:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-27 13:20 [PATCH v5 0/2] staging: ion: get one device " Benjamin Gaignard
2017-09-27 13:20 ` [PATCH v5 1/2] staging: ion: simplify ioctl args checking function Benjamin Gaignard
2017-10-09 9:21 ` Benjamin Gaignard
2017-10-09 16:45 ` Laura Abbott
2017-09-27 13:20 ` [PATCH v5 2/2] staging: ion: create one device entry per heap Benjamin Gaignard
2017-10-02 18:07 ` Laura Abbott
2017-10-03 16:48 ` Mark Brown
2017-10-03 21:42 ` Laura Abbott
2017-10-03 23:08 ` Sandeep Patil
2017-10-03 23:37 ` Laura Abbott
2017-10-04 10:17 ` Mark Brown
2017-10-05 13:06 ` Benjamin Gaignard
2017-10-09 21:25 ` Laura Abbott
2017-10-09 22:08 ` Mark Brown
2017-10-10 0:10 ` Laura Abbott
2017-10-10 9:11 ` Mark Brown
2017-10-16 22:09 ` Laura Abbott
2017-10-17 12:39 ` Benjamin Gaignard
2017-10-18 20:07 ` Laura Abbott [this message]
2017-10-23 15:19 ` Benjamin Gaignard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bff3d0c7-110d-d702-165b-855daaca6382@redhat.com \
--to=labbott@redhat.com \
--cc=arve@android.com \
--cc=benjamin.gaignard@linaro.org \
--cc=broonie@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=riandrews@android.com \
--cc=sumit.semwal@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®