[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <586da154-5494-aaab-aa07-30f77daebbc2@suse.de>
Date: Mon, 25 Apr 2022 10:02:20 +0200
From: Thomas Zimmermann <tzimmermann@...e.de>
To: Javier Martinez Canillas <javierm@...hat.com>,
linux-kernel@...r.kernel.org
Cc: Miaoqian Lin <linmq006@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
dri-devel@...ts.freedesktop.org, Johan Hovold <johan@...nel.org>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Borislav Petkov <bp@...e.de>
Subject: Re: [PATCH v3 1/5] firmware: sysfb: Make sysfb_create_simplefb()
return a pdev pointer
Am 20.04.22 um 10:52 schrieb Javier Martinez Canillas:
> This function just returned 0 on success or an errno code on error, but it
> could be useful for sysfb_init() callers to have a pointer to the device.
>
> Signed-off-by: Javier Martinez Canillas <javierm@...hat.com>
> Reviewed-by: Daniel Vetter <daniel.vetter@...ll.ch>
Reviewed-by: Thomas Zimmermann <tzimmermann@...e.de>
> ---
>
> (no changes since v2)
>
> Changes in v2:
> - Rebase on top of latest drm-misc-next and fix conflicts (Daniel Vetter).
>
> drivers/firmware/sysfb.c | 4 ++--
> drivers/firmware/sysfb_simplefb.c | 16 ++++++++--------
> include/linux/sysfb.h | 10 +++++-----
> 3 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
> index 2bfbb05f7d89..b032f40a92de 100644
> --- a/drivers/firmware/sysfb.c
> +++ b/drivers/firmware/sysfb.c
> @@ -46,8 +46,8 @@ static __init int sysfb_init(void)
> /* try to create a simple-framebuffer device */
> compatible = sysfb_parse_mode(si, &mode);
> if (compatible) {
> - ret = sysfb_create_simplefb(si, &mode);
> - if (!ret)
> + pd = sysfb_create_simplefb(si, &mode);
> + if (!IS_ERR(pd))
> return 0;
> }
>
> diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_simplefb.c
> index bda8712bfd8c..a353e27f83f5 100644
> --- a/drivers/firmware/sysfb_simplefb.c
> +++ b/drivers/firmware/sysfb_simplefb.c
> @@ -57,8 +57,8 @@ __init bool sysfb_parse_mode(const struct screen_info *si,
> return false;
> }
>
> -__init int sysfb_create_simplefb(const struct screen_info *si,
> - const struct simplefb_platform_data *mode)
> +__init struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
> + const struct simplefb_platform_data *mode)
> {
> struct platform_device *pd;
> struct resource res;
> @@ -76,7 +76,7 @@ __init int sysfb_create_simplefb(const struct screen_info *si,
> base |= (u64)si->ext_lfb_base << 32;
> if (!base || (u64)(resource_size_t)base != base) {
> printk(KERN_DEBUG "sysfb: inaccessible VRAM base\n");
> - return -EINVAL;
> + return ERR_PTR(-EINVAL);
> }
>
> /*
> @@ -93,7 +93,7 @@ __init int sysfb_create_simplefb(const struct screen_info *si,
> length = mode->height * mode->stride;
> if (length > size) {
> printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n");
> - return -EINVAL;
> + return ERR_PTR(-EINVAL);
> }
> length = PAGE_ALIGN(length);
>
> @@ -104,11 +104,11 @@ __init int sysfb_create_simplefb(const struct screen_info *si,
> res.start = base;
> res.end = res.start + length - 1;
> if (res.end <= res.start)
> - return -EINVAL;
> + return ERR_PTR(-EINVAL);
>
> pd = platform_device_alloc("simple-framebuffer", 0);
> if (!pd)
> - return -ENOMEM;
> + return ERR_PTR(-ENOMEM);
>
> sysfb_apply_efi_quirks(pd);
>
> @@ -124,10 +124,10 @@ __init int sysfb_create_simplefb(const struct screen_info *si,
> if (ret)
> goto err_put_device;
>
> - return 0;
> + return pd;
>
> err_put_device:
> platform_device_put(pd);
>
> - return ret;
> + return ERR_PTR(ret);
> }
> diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h
> index b0dcfa26d07b..708152e9037b 100644
> --- a/include/linux/sysfb.h
> +++ b/include/linux/sysfb.h
> @@ -72,8 +72,8 @@ static inline void sysfb_apply_efi_quirks(struct platform_device *pd)
>
> bool sysfb_parse_mode(const struct screen_info *si,
> struct simplefb_platform_data *mode);
> -int sysfb_create_simplefb(const struct screen_info *si,
> - const struct simplefb_platform_data *mode);
> +struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
> + const struct simplefb_platform_data *mode);
>
> #else /* CONFIG_SYSFB_SIMPLE */
>
> @@ -83,10 +83,10 @@ static inline bool sysfb_parse_mode(const struct screen_info *si,
> return false;
> }
>
> -static inline int sysfb_create_simplefb(const struct screen_info *si,
> - const struct simplefb_platform_data *mode)
> +static inline struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
> + const struct simplefb_platform_data *mode)
> {
> - return -EINVAL;
> + return ERR_PTR(-EINVAL);
> }
>
> #endif /* CONFIG_SYSFB_SIMPLE */
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)
Powered by blists - more mailing lists