linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Handle efifb with no lfb_base better.
@ 2013-04-23 15:23 Peter Jones
  2013-06-25 14:17 ` Josh Boyer
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Jones @ 2013-04-23 15:23 UTC (permalink / raw)
  To: Florian Tobias Schandinat
  Cc: Josh Boyer, linux-fbdev, linux-kernel, Peter Jones

Right now we get a WARN from platform_device_unregister() because our
platform_device has no ->release function.  This is clearly wrong, but
we should be warning so we can figure out what happened, as this failure
results in bug reports.  So WARN() about the real problem, and use the
registration function that gives us a default release() function.

This fixes the tracback reported at
https://bugzilla.redhat.com/show_bug.cgi?id„0621 , though it does not
fix the actual /problem/ the user is seeing.

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 drivers/video/efifb.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
index 50fe668..390b61b 100644
--- a/drivers/video/efifb.c
+++ b/drivers/video/efifb.c
@@ -285,6 +285,7 @@ static void efifb_destroy(struct fb_info *info)
 {
 	if (info->screen_base)
 		iounmap(info->screen_base);
+	fb_dealloc_cmap(&info->cmap);
 	if (request_mem_succeeded)
 		release_mem_region(info->apertures->ranges[0].base,
 				   info->apertures->ranges[0].size);
@@ -382,6 +383,8 @@ static int __init efifb_probe(struct platform_device *dev)
 	if (!screen_info.pages)
 		screen_info.pages = 1;
 	if (!screen_info.lfb_base) {
+		WARN(1, KERN_WARNING, "invalid framebuffer address for "
+				      "device '%s'\n", dev_name(dev));
 		printk(KERN_DEBUG "efifb: invalid framebuffer address\n");
 		return -ENODEV;
 	}
@@ -544,9 +547,7 @@ static struct platform_driver efifb_driver = {
 	},
 };
 
-static struct platform_device efifb_device = {
-	.name	= "efifb",
-};
+static struct platform_device *efifb_device;
 
 static int __init efifb_init(void)
 {
@@ -571,9 +572,9 @@ static int __init efifb_init(void)
 	if (!screen_info.lfb_linelength)
 		return -ENODEV;
 
-	ret = platform_device_register(&efifb_device);
-	if (ret)
-		return ret;
+	efifb_device = platform_device_register_simple("efifb", 0, NULL, 0);
+	if (IS_ERROR(efifb_device))
+		return PTR_ERR(efifb_device);
 
 	/*
 	 * This is not just an optimization.  We will interfere
@@ -582,7 +583,7 @@ static int __init efifb_init(void)
 	 */
 	ret = platform_driver_probe(&efifb_driver, efifb_probe);
 	if (ret) {
-		platform_device_unregister(&efifb_device);
+		platform_device_unregister(efifb_device);
 		return ret;
 	}
 
-- 
1.8.1.4


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

* Re: [PATCH] Handle efifb with no lfb_base better.
  2013-04-23 15:23 [PATCH] Handle efifb with no lfb_base better Peter Jones
@ 2013-06-25 14:17 ` Josh Boyer
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Boyer @ 2013-06-25 14:17 UTC (permalink / raw)
  To: Peter Jones; +Cc: Florian Tobias Schandinat, linux-fbdev, linux-kernel

On Tue, Apr 23, 2013 at 11:23:18AM -0400, Peter Jones wrote:
> Right now we get a WARN from platform_device_unregister() because our
> platform_device has no ->release function.  This is clearly wrong, but
> we should be warning so we can figure out what happened, as this failure
> results in bug reports.  So WARN() about the real problem, and use the
> registration function that gives us a default release() function.
> 
> This fixes the tracback reported at
> https://bugzilla.redhat.com/show_bug.cgi?id„0621 , though it does not
> fix the actual /problem/ the user is seeing.
> 
> Signed-off-by: Peter Jones <pjones@redhat.com>

Is anyone in the fdbdev camp looking at this?  It's been 2 months since
this was sent out without any comments and I don't see it in the tree
anywhere.

josh

> ---
>  drivers/video/efifb.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
> index 50fe668..390b61b 100644
> --- a/drivers/video/efifb.c
> +++ b/drivers/video/efifb.c
> @@ -285,6 +285,7 @@ static void efifb_destroy(struct fb_info *info)
>  {
>  	if (info->screen_base)
>  		iounmap(info->screen_base);
> +	fb_dealloc_cmap(&info->cmap);
>  	if (request_mem_succeeded)
>  		release_mem_region(info->apertures->ranges[0].base,
>  				   info->apertures->ranges[0].size);
> @@ -382,6 +383,8 @@ static int __init efifb_probe(struct platform_device *dev)
>  	if (!screen_info.pages)
>  		screen_info.pages = 1;
>  	if (!screen_info.lfb_base) {
> +		WARN(1, KERN_WARNING, "invalid framebuffer address for "
> +				      "device '%s'\n", dev_name(dev));
>  		printk(KERN_DEBUG "efifb: invalid framebuffer address\n");
>  		return -ENODEV;
>  	}
> @@ -544,9 +547,7 @@ static struct platform_driver efifb_driver = {
>  	},
>  };
>  
> -static struct platform_device efifb_device = {
> -	.name	= "efifb",
> -};
> +static struct platform_device *efifb_device;
>  
>  static int __init efifb_init(void)
>  {
> @@ -571,9 +572,9 @@ static int __init efifb_init(void)
>  	if (!screen_info.lfb_linelength)
>  		return -ENODEV;
>  
> -	ret = platform_device_register(&efifb_device);
> -	if (ret)
> -		return ret;
> +	efifb_device = platform_device_register_simple("efifb", 0, NULL, 0);
> +	if (IS_ERROR(efifb_device))
> +		return PTR_ERR(efifb_device);
>  
>  	/*
>  	 * This is not just an optimization.  We will interfere
> @@ -582,7 +583,7 @@ static int __init efifb_init(void)
>  	 */
>  	ret = platform_driver_probe(&efifb_driver, efifb_probe);
>  	if (ret) {
> -		platform_device_unregister(&efifb_device);
> +		platform_device_unregister(efifb_device);
>  		return ret;
>  	}
>  
> -- 
> 1.8.1.4
> 

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

end of thread, other threads:[~2013-06-25 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23 15:23 [PATCH] Handle efifb with no lfb_base better Peter Jones
2013-06-25 14:17 ` Josh Boyer

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).