Commit f5c6291f authored by Thomas Zimmermann's avatar Thomas Zimmermann

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Cc: Steve Glendinning <steve.glendinning@shawell.net>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-31-tzimmermann@suse.de
parent 1d4423d3
...@@ -1496,7 +1496,7 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info, ...@@ -1496,7 +1496,7 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info,
u8 *edid; u8 *edid;
int i, result = 0, tries = 3; 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); mutex_lock(&info->lock);
edid = kmalloc(EDID_LENGTH, GFP_KERNEL); edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
...@@ -1610,7 +1610,7 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info, ...@@ -1610,7 +1610,7 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info,
if (edid && (dev->edid != edid)) if (edid && (dev->edid != edid))
kfree(edid); kfree(edid);
if (info->dev) if (refcount_read(&info->count))
mutex_unlock(&info->lock); mutex_unlock(&info->lock);
return result; return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment