All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: use ATOMIC64_INIT() for atomic64_t
@ 2024-01-11  2:30 Jonathan Gray
  2024-01-11  9:56 ` Jani Nikula
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Gray @ 2024-01-11  2:30 UTC (permalink / raw)
  To: dri-devel; +Cc: robdclark, tzimmermann, mripard

use ATOMIC64_INIT() not ATOMIC_INIT() for atomic64_t

Fixes: 3f09a0cd4ea3 ("drm: Add common fdinfo helper")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
---
 drivers/gpu/drm/drm_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index 446458aca8e9..d3b10dd91584 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -149,7 +149,7 @@ bool drm_dev_needs_global_mutex(struct drm_device *dev)
  */
 struct drm_file *drm_file_alloc(struct drm_minor *minor)
 {
-	static atomic64_t ident = ATOMIC_INIT(0);
+	static atomic64_t ident = ATOMIC64_INIT(0);
 	struct drm_device *dev = minor->dev;
 	struct drm_file *file;
 	int ret;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm: use ATOMIC64_INIT() for atomic64_t
  2024-01-11  2:30 [PATCH] drm: use ATOMIC64_INIT() for atomic64_t Jonathan Gray
@ 2024-01-11  9:56 ` Jani Nikula
  2024-11-05 11:17   ` Jonathan Gray
  0 siblings, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2024-01-11  9:56 UTC (permalink / raw)
  To: Jonathan Gray, dri-devel; +Cc: robdclark, mripard, tzimmermann

On Thu, 11 Jan 2024, Jonathan Gray <jsg@jsg.id.au> wrote:
> use ATOMIC64_INIT() not ATOMIC_INIT() for atomic64_t
>
> Fixes: 3f09a0cd4ea3 ("drm: Add common fdinfo helper")
> Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/drm_file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> index 446458aca8e9..d3b10dd91584 100644
> --- a/drivers/gpu/drm/drm_file.c
> +++ b/drivers/gpu/drm/drm_file.c
> @@ -149,7 +149,7 @@ bool drm_dev_needs_global_mutex(struct drm_device *dev)
>   */
>  struct drm_file *drm_file_alloc(struct drm_minor *minor)
>  {
> -	static atomic64_t ident = ATOMIC_INIT(0);
> +	static atomic64_t ident = ATOMIC64_INIT(0);

I think we should probably redefine both ATOMIC_INIT and ATOMIC64_INIT
to cast the result to the correct type to avoid this problem once and
for all.

If we had

#define ATOMIC_INIT(i) (atomic_t){ (i) }

and

#define ATOMIC64_INIT(i) (atomic64_t){ (i) }

we'd get a build failure using them incorrectly.

BR,
Jani.


>  	struct drm_device *dev = minor->dev;
>  	struct drm_file *file;
>  	int ret;

-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm: use ATOMIC64_INIT() for atomic64_t
  2024-01-11  9:56 ` Jani Nikula
@ 2024-11-05 11:17   ` Jonathan Gray
  2024-11-05 12:14     ` Jani Nikula
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Gray @ 2024-11-05 11:17 UTC (permalink / raw)
  To: Jani Nikula; +Cc: dri-devel

On Thu, Jan 11, 2024 at 11:56:20AM +0200, Jani Nikula wrote:
> On Thu, 11 Jan 2024, Jonathan Gray <jsg@jsg.id.au> wrote:
> > use ATOMIC64_INIT() not ATOMIC_INIT() for atomic64_t
> >
> > Fixes: 3f09a0cd4ea3 ("drm: Add common fdinfo helper")
> > Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>

This patch didn't get merged.  Should I resend it?

> 
> > ---
> >  drivers/gpu/drm/drm_file.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> > index 446458aca8e9..d3b10dd91584 100644
> > --- a/drivers/gpu/drm/drm_file.c
> > +++ b/drivers/gpu/drm/drm_file.c
> > @@ -149,7 +149,7 @@ bool drm_dev_needs_global_mutex(struct drm_device *dev)
> >   */
> >  struct drm_file *drm_file_alloc(struct drm_minor *minor)
> >  {
> > -	static atomic64_t ident = ATOMIC_INIT(0);
> > +	static atomic64_t ident = ATOMIC64_INIT(0);
> 
> I think we should probably redefine both ATOMIC_INIT and ATOMIC64_INIT
> to cast the result to the correct type to avoid this problem once and
> for all.
> 
> If we had
> 
> #define ATOMIC_INIT(i) (atomic_t){ (i) }
> 
> and
> 
> #define ATOMIC64_INIT(i) (atomic64_t){ (i) }
> 
> we'd get a build failure using them incorrectly.
> 
> BR,
> Jani.
> 
> 
> >  	struct drm_device *dev = minor->dev;
> >  	struct drm_file *file;
> >  	int ret;
> 
> -- 
> Jani Nikula, Intel
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm: use ATOMIC64_INIT() for atomic64_t
  2024-11-05 11:17   ` Jonathan Gray
@ 2024-11-05 12:14     ` Jani Nikula
  0 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2024-11-05 12:14 UTC (permalink / raw)
  To: Jonathan Gray; +Cc: dri-devel

On Tue, 05 Nov 2024, Jonathan Gray <jsg@jsg.id.au> wrote:
> On Thu, Jan 11, 2024 at 11:56:20AM +0200, Jani Nikula wrote:
>> On Thu, 11 Jan 2024, Jonathan Gray <jsg@jsg.id.au> wrote:
>> > use ATOMIC64_INIT() not ATOMIC_INIT() for atomic64_t
>> >
>> > Fixes: 3f09a0cd4ea3 ("drm: Add common fdinfo helper")
>> > Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
>> 
>> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
> This patch didn't get merged.  Should I resend it?

Apologies, it fell between the cracks. Pushed to drm-misc-next now,
thanks for the patch.

BR,
Jani.


-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-05 12:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-11  2:30 [PATCH] drm: use ATOMIC64_INIT() for atomic64_t Jonathan Gray
2024-01-11  9:56 ` Jani Nikula
2024-11-05 11:17   ` Jonathan Gray
2024-11-05 12:14     ` Jani Nikula

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.