[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230613110953.24176-31-tzimmermann@suse.de>
Date: Tue, 13 Jun 2023 13:07:05 +0200
From: Thomas Zimmermann <tzimmermann@...e.de>
To: daniel@...ll.ch, javierm@...hat.com, sam@...nborg.org,
deller@....de, geert+renesas@...der.be, lee@...nel.org,
daniel.thompson@...aro.org, jingoohan1@...il.com,
dan.carpenter@...aro.org, michael.j.ruhl@...el.com
Cc: linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-sh@...r.kernel.org, linux-omap@...r.kernel.org,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
Thomas Zimmermann <tzimmermann@...e.de>,
Steve Glendinning <steve.glendinning@...well.net>
Subject: [PATCH v3 30/38] fbdev/smscufx: Detect registered fb_info from refcount
Detect registered instances of fb_info by reading the reference
counter from struct fb_info.read. Avoids looking at the dev field
and prepares fbdev for making struct fb_info.dev optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@...e.de>
Cc: Steve Glendinning <steve.glendinning@...well.net>
Reviewed-by: Javier Martinez Canillas <javierm@...hat.com>
---
drivers/video/fbdev/smscufx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c
index 17cec62cc65db..adb2b1fe8383c 100644
--- a/drivers/video/fbdev/smscufx.c
+++ b/drivers/video/fbdev/smscufx.c
@@ -1496,7 +1496,7 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info,
u8 *edid;
int i, result = 0, tries = 3;
- if (info->dev) /* only use mutex if info has been registered */
+ if (refcount_read(&info->count)) /* only use mutex if info has been registered */
mutex_lock(&info->lock);
edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
@@ -1610,7 +1610,7 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info,
if (edid && (dev->edid != edid))
kfree(edid);
- if (info->dev)
+ if (refcount_read(&info->count))
mutex_unlock(&info->lock);
return result;
--
2.41.0
Powered by blists - more mailing lists