From: Javier Martinez Canillas <javierm@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
zackr@vmware.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, airlied@linux.ie, daniel@ffwll.ch,
deller@gmx.de, hdegoede@redhat.com
Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 4/5] fbdev/simplefb: Request memory region in driver
Date: Mon, 24 Jan 2022 15:24:59 +0100 [thread overview]
Message-ID: <ef39d2c9-4825-9d40-100d-6461f71ee67e@redhat.com> (raw)
In-Reply-To: <20220124123659.4692-5-tzimmermann@suse.de>
On 1/24/22 13:36, Thomas Zimmermann wrote:
> Requesting the framebuffer memory in simpledrm marks the memory
> range as busy. This used to be done by the firmware sysfb code,
> but the driver is the correct place.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/video/fbdev/simplefb.c | 59 ++++++++++++++++++++++++----------
> 1 file changed, 42 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
> index 57541887188b..84452028ecc9 100644
> --- a/drivers/video/fbdev/simplefb.c
> +++ b/drivers/video/fbdev/simplefb.c
> @@ -66,16 +66,36 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
> return 0;
> }
>
> -struct simplefb_par;
> +struct simplefb_par {
> + u32 palette[PSEUDO_PALETTE_SIZE];
> +#if defined CONFIG_OF && defined CONFIG_COMMON_CLK
> + bool clks_enabled;
> + unsigned int clk_count;
> + struct clk **clks;
> +#endif
> +#if defined CONFIG_OF && defined CONFIG_REGULATOR
> + bool regulators_enabled;
> + u32 regulator_count;
> + struct regulator **regulators;
> +#endif
> + bool release_mem_region;
Maybe instead you could have:
struct resource *mem;
that would be more consistent with the fields for the other
resources like clocks, regulators, etc.
> +};
> +
> static void simplefb_clocks_destroy(struct simplefb_par *par);
> static void simplefb_regulators_destroy(struct simplefb_par *par);
>
> static void simplefb_destroy(struct fb_info *info)
> {
> + struct simplefb_par *par = info->par;
> +
> simplefb_regulators_destroy(info->par);
> simplefb_clocks_destroy(info->par);
> if (info->screen_base)
> iounmap(info->screen_base);
> +
> + if (par->release_mem_region)
> + release_mem_region(info->apertures->ranges[0].base,
> + info->apertures->ranges[0].size);
and here you could instead use the pointer to the resource:
if (par->mem)
release_mem_region(par->mem->start, resource_size(par->mem));
[snip]
> static int simplefb_probe(struct platform_device *pdev)
> {
> + bool request_mem_succeeded = false;
> int ret;
> struct simplefb_params params;
> struct fb_info *info;
> @@ -436,9 +443,22 @@ static int simplefb_probe(struct platform_device *pdev)
> return -EINVAL;
> }
>
> + if (request_mem_region(mem->start, resource_size(mem), "simplefb")) {
> + request_mem_succeeded = true;
and if you do the request_mem_region() after the struct fb_info allocation then
this could just be:
par->mem = mem;
Best regards,
--
Javier Martinez Canillas
Linux Engineering
Red Hat
next prev parent reply other threads:[~2022-01-24 14:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 12:36 [PATCH 0/5] sysfb: Fix memory-region management Thomas Zimmermann
2022-01-24 12:36 ` [PATCH 1/5] fbdev: Hot-unplug firmware fb devices on forced removal Thomas Zimmermann
2022-01-24 13:52 ` Javier Martinez Canillas
2022-01-24 13:56 ` Javier Martinez Canillas
2022-01-24 14:19 ` Thomas Zimmermann
2022-01-24 14:31 ` Javier Martinez Canillas
2022-01-24 15:59 ` Zack Rusin
2022-01-24 12:36 ` [PATCH 2/5] drivers/firmware: Don't mark as busy the simple-framebuffer IO resource Thomas Zimmermann
2022-01-24 15:59 ` Zack Rusin
2022-01-24 12:36 ` [PATCH 3/5] drm/simpledrm: Request memory region in driver Thomas Zimmermann
2022-01-24 14:00 ` Javier Martinez Canillas
2022-01-24 14:23 ` Jocelyn Falempe
2022-01-25 8:31 ` Thomas Zimmermann
2022-01-24 12:36 ` [PATCH 4/5] fbdev/simplefb: " Thomas Zimmermann
2022-01-24 14:24 ` Javier Martinez Canillas [this message]
2022-01-24 12:36 ` [PATCH 5/5] drm: Add TODO item for requesting memory regions Thomas Zimmermann
2022-01-24 14:25 ` Javier Martinez Canillas
-- strict thread matches above, loose matches on Subject: below --
2022-01-25 9:12 [PATCH 0/5] sysfb: Fix memory-region management Thomas Zimmermann
2022-01-25 9:12 ` [PATCH 4/5] fbdev/simplefb: Request memory region in driver Thomas Zimmermann
2022-01-25 9:33 ` Javier Martinez Canillas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ef39d2c9-4825-9d40-100d-6461f71ee67e@redhat.com \
--to=javierm@redhat.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
--cc=zackr@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).