lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAO_48GH_RyeTkUsZ9Ad=o2D+Poh3DVQnXiOmyApuWy2Ycn5P5w@mail.gmail.com>
Date: Thu, 7 Mar 2024 13:07:15 +0530
From: Sumit Semwal <sumit.semwal@...aro.org>
To: "T.J. Mercier" <tjmercier@...gle.com>
Cc: "Ricardo B. Marliere" <ricardo@...liere.net>, 
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>, 
	Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>, 
	Hans de Goede <hdegoede@...hat.com>, Helge Deller <deller@....de>, 
	Benjamin Gaignard <benjamin.gaignard@...labora.com>, Brian Starkey <Brian.Starkey@....com>, 
	John Stultz <jstultz@...gle.com>, Christian König <christian.koenig@....com>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>, dri-devel@...ts.freedesktop.org, 
	linux-kernel@...r.kernel.org, linux-fbdev@...r.kernel.org, 
	linux-media@...r.kernel.org, linaro-mm-sig@...ts.linaro.org
Subject: Re: [PATCH RESEND drm-misc 4/4] dma-buf: heaps: make dma_heap_class constant

Hello Ricardo,

On Tue, 5 Mar 2024 at 22:37, T.J. Mercier <tjmercier@...gle.com> wrote:
>
> On Tue, Mar 5, 2024 at 3:34 AM Ricardo B. Marliere <ricardo@...liere.net> wrote:
> >
> > Since commit 43a7206b0963 ("driver core: class: make class_register() take
> > a const *"), the driver core allows for struct class to be in read-only
> > memory, so move the dma_heap_class structure to be declared at build time
> > placing it into read-only memory, instead of having to be dynamically
> > allocated at boot time.
> >
> > Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > Suggested-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > Signed-off-by: Ricardo B. Marliere <ricardo@...liere.net>
> > ---
> >  drivers/dma-buf/dma-heap.c | 26 ++++++++++++++------------
> >  1 file changed, 14 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
> > index 84ae708fafe7..bcca6a2bbce8 100644
> > --- a/drivers/dma-buf/dma-heap.c
> > +++ b/drivers/dma-buf/dma-heap.c
> > @@ -43,10 +43,18 @@ struct dma_heap {
> >         struct cdev heap_cdev;
> >  };
> >
> > +static char *dma_heap_devnode(const struct device *dev, umode_t *mode)
> > +{
> > +       return kasprintf(GFP_KERNEL, "dma_heap/%s", dev_name(dev));
> > +}
> > +
> >  static LIST_HEAD(heap_list);
> >  static DEFINE_MUTEX(heap_list_lock);
> >  static dev_t dma_heap_devt;
> > -static struct class *dma_heap_class;
> > +static struct class dma_heap_class = {
> > +       .name = DEVNAME,
> > +       .devnode = dma_heap_devnode,
> > +};
> >  static DEFINE_XARRAY_ALLOC(dma_heap_minors);
> >
> >  static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
> > @@ -261,7 +269,7 @@ struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info)
> >                 goto err1;
> >         }
> >
> > -       dev_ret = device_create(dma_heap_class,
> > +       dev_ret = device_create(&dma_heap_class,
> >                                 NULL,
> >                                 heap->heap_devt,
> >                                 NULL,
> > @@ -291,7 +299,7 @@ struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info)
> >         return heap;
> >
> >  err3:
> > -       device_destroy(dma_heap_class, heap->heap_devt);
> > +       device_destroy(&dma_heap_class, heap->heap_devt);
> >  err2:
> >         cdev_del(&heap->heap_cdev);
> >  err1:
> > @@ -301,11 +309,6 @@ struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info)
> >         return err_ret;
> >  }
> >
> > -static char *dma_heap_devnode(const struct device *dev, umode_t *mode)
> > -{
> > -       return kasprintf(GFP_KERNEL, "dma_heap/%s", dev_name(dev));
> > -}
> > -
> >  static int dma_heap_init(void)
> >  {
> >         int ret;
> > @@ -314,12 +317,11 @@ static int dma_heap_init(void)
> >         if (ret)
> >                 return ret;
> >
> > -       dma_heap_class = class_create(DEVNAME);
> > -       if (IS_ERR(dma_heap_class)) {
> > +       ret = class_register(&dma_heap_class);
> > +       if (ret) {
> >                 unregister_chrdev_region(dma_heap_devt, NUM_HEAP_MINORS);
> > -               return PTR_ERR(dma_heap_class);
> > +               return ret;
> >         }
> > -       dma_heap_class->devnode = dma_heap_devnode;
> >
> >         return 0;
> >  }
> >
> > --
> > 2.43.0
>
> Reviewed-by: T.J. Mercier <tjmercier@...gle.com>


FWIW, please free to add my
Acked-by: Sumit Semwal <sumit.semwal@...aro.org>

>
>
> Is this really a resend? I don't see anything on lore and I can't
> recall seeing this patch in my inbox before.


Best,
Sumit.

-- 
Thanks and regards,

Sumit Semwal (he / him)
Tech Lead - LCG, Vertical Technologies
Linaro.org │ Open source software for ARM SoCs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ