All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: panel: register driver after checking device
@ 2015-02-10 11:56 Sudip Mukherjee
  2015-02-10 11:56 ` [PATCH 2/2] staging: panel: initialize lcd if lcd enabled Sudip Mukherjee
  2015-02-10 17:51 ` [PATCH 1/2] staging: panel: register driver after checking device Willy Tarreau
  0 siblings, 2 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2015-02-10 11:56 UTC (permalink / raw)
  To: Willy Tarreau, Greg Kroah-Hartman; +Cc: Sudip Mukherjee, devel, linux-kernel

register the driver only if lcd or keypad has been enabled and if
both are disabled then just exit.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/panel/panel.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 6ed35b6..df044b2 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2379,23 +2379,17 @@ static int __init panel_init_module(void)
 	/* tells various subsystems about the fact that we are initializing */
 	init_in_progress = 1;
 
-	if (parport_register_driver(&panel_driver)) {
-		pr_err("could not register with parport. Aborting.\n");
-		return -EIO;
-	}
-
 	if (!lcd.enabled && !keypad.enabled) {
-		/* no device enabled, let's release the parport */
-		if (pprt) {
-			parport_release(pprt);
-			parport_unregister_device(pprt);
-			pprt = NULL;
-		}
-		parport_unregister_driver(&panel_driver);
+		/* no device enabled, let's exit */
 		pr_err("driver version " PANEL_VERSION " disabled.\n");
 		return -ENODEV;
 	}
 
+	if (parport_register_driver(&panel_driver)) {
+		pr_err("could not register with parport. Aborting.\n");
+		return -EIO;
+	}
+
 	register_reboot_notifier(&panel_notifier);
 
 	if (pprt)
-- 
1.8.1.2


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

* [PATCH 2/2] staging: panel: initialize lcd if lcd enabled
  2015-02-10 11:56 [PATCH 1/2] staging: panel: register driver after checking device Sudip Mukherjee
@ 2015-02-10 11:56 ` Sudip Mukherjee
  2015-02-10 17:53   ` Willy Tarreau
  2015-02-10 17:51 ` [PATCH 1/2] staging: panel: register driver after checking device Willy Tarreau
  1 sibling, 1 reply; 4+ messages in thread
From: Sudip Mukherjee @ 2015-02-10 11:56 UTC (permalink / raw)
  To: Willy Tarreau, Greg Kroah-Hartman; +Cc: Sudip Mukherjee, devel, linux-kernel

initialiaze lcd parameters only if lcd is enabled.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/panel/panel.c | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index df044b2..05657f2 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2323,25 +2323,6 @@ static int __init panel_init_module(void)
 		break;
 	}
 
-	/*
-	 * Init lcd struct with load-time values to preserve exact current
-	 * functionality (at least for now).
-	 */
-	lcd.height = lcd_height;
-	lcd.width = lcd_width;
-	lcd.bwidth = lcd_bwidth;
-	lcd.hwidth = lcd_hwidth;
-	lcd.charset = lcd_charset;
-	lcd.proto = lcd_proto;
-	lcd.pins.e = lcd_e_pin;
-	lcd.pins.rs = lcd_rs_pin;
-	lcd.pins.rw = lcd_rw_pin;
-	lcd.pins.cl = lcd_cl_pin;
-	lcd.pins.da = lcd_da_pin;
-	lcd.pins.bl = lcd_bl_pin;
-
-	/* Leave it for now, just in case */
-	lcd.esc_seq.len = -1;
 
 	/*
 	 * Overwrite selection with module param values (both keypad and lcd),
@@ -2361,6 +2342,28 @@ static int __init panel_init_module(void)
 
 	lcd.enabled = (selected_lcd_type > 0);
 
+	if (lcd.enabled) {
+		/*
+		 * Init lcd struct with load-time values to preserve exact
+		 * current functionality (at least for now).
+		 */
+		lcd.height = lcd_height;
+		lcd.width = lcd_width;
+		lcd.bwidth = lcd_bwidth;
+		lcd.hwidth = lcd_hwidth;
+		lcd.charset = lcd_charset;
+		lcd.proto = lcd_proto;
+		lcd.pins.e = lcd_e_pin;
+		lcd.pins.rs = lcd_rs_pin;
+		lcd.pins.rw = lcd_rw_pin;
+		lcd.pins.cl = lcd_cl_pin;
+		lcd.pins.da = lcd_da_pin;
+		lcd.pins.bl = lcd_bl_pin;
+
+	/* Leave it for now, just in case */
+		lcd.esc_seq.len = -1;
+	}
+
 	switch (selected_keypad_type) {
 	case KEYPAD_TYPE_OLD:
 		keypad_profile = old_keypad_profile;
-- 
1.8.1.2


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

* Re: [PATCH 1/2] staging: panel: register driver after checking device
  2015-02-10 11:56 [PATCH 1/2] staging: panel: register driver after checking device Sudip Mukherjee
  2015-02-10 11:56 ` [PATCH 2/2] staging: panel: initialize lcd if lcd enabled Sudip Mukherjee
@ 2015-02-10 17:51 ` Willy Tarreau
  1 sibling, 0 replies; 4+ messages in thread
From: Willy Tarreau @ 2015-02-10 17:51 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Willy Tarreau, Greg Kroah-Hartman, devel, linux-kernel

On Tue, Feb 10, 2015 at 05:26:02PM +0530, Sudip Mukherjee wrote:
> register the driver only if lcd or keypad has been enabled and if
> both are disabled then just exit.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>

Acked-by: Willy Tarreau <w@1wt.eu>

Willy


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

* Re: [PATCH 2/2] staging: panel: initialize lcd if lcd enabled
  2015-02-10 11:56 ` [PATCH 2/2] staging: panel: initialize lcd if lcd enabled Sudip Mukherjee
@ 2015-02-10 17:53   ` Willy Tarreau
  0 siblings, 0 replies; 4+ messages in thread
From: Willy Tarreau @ 2015-02-10 17:53 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Willy Tarreau, Greg Kroah-Hartman, devel, linux-kernel

On Tue, Feb 10, 2015 at 05:26:03PM +0530, Sudip Mukherjee wrote:
> initialiaze lcd parameters only if lcd is enabled.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>

One minor comment below (cosmetic), but after this it's OK.
Acked-by: Willy Tarreau <w@1wt.eu>

> +	if (lcd.enabled) {
> +		/*
> +		 * Init lcd struct with load-time values to preserve exact
> +		 * current functionality (at least for now).
> +		 */
> +		lcd.height = lcd_height;
> +		lcd.width = lcd_width;
> +		lcd.bwidth = lcd_bwidth;
> +		lcd.hwidth = lcd_hwidth;
> +		lcd.charset = lcd_charset;
> +		lcd.proto = lcd_proto;
> +		lcd.pins.e = lcd_e_pin;
> +		lcd.pins.rs = lcd_rs_pin;
> +		lcd.pins.rw = lcd_rw_pin;
> +		lcd.pins.cl = lcd_cl_pin;
> +		lcd.pins.da = lcd_da_pin;
> +		lcd.pins.bl = lcd_bl_pin;
> +
> +	/* Leave it for now, just in case */
^^^^^^^^^^^^^^^^^^^
Please fix indenting the comment here.

> +		lcd.esc_seq.len = -1;
> +	}
> +

Willy


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

end of thread, other threads:[~2015-02-10 17:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-10 11:56 [PATCH 1/2] staging: panel: register driver after checking device Sudip Mukherjee
2015-02-10 11:56 ` [PATCH 2/2] staging: panel: initialize lcd if lcd enabled Sudip Mukherjee
2015-02-10 17:53   ` Willy Tarreau
2015-02-10 17:51 ` [PATCH 1/2] staging: panel: register driver after checking device Willy Tarreau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.