linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] auxdisplay: panel: Switch to use module_parport_driver()
@ 2021-06-16 14:20 Andy Shevchenko
  2021-06-21 20:13 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2021-06-16 14:20 UTC (permalink / raw)
  To: Miguel Ojeda, Lars Poeschel, linux-kernel
  Cc: Willy Tarreau, Ksenija Stanojevic, Andy Shevchenko

Switch to use module_parport_driver() to reduce boilerplate code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/auxdisplay/panel.c | 200 ++++++++++++++++---------------------
 1 file changed, 88 insertions(+), 112 deletions(-)

diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c
index eba04c0de7eb..a1b5b5134242 100644
--- a/drivers/auxdisplay/panel.c
+++ b/drivers/auxdisplay/panel.c
@@ -1520,106 +1520,9 @@ static void keypad_init(void)
 
 static void panel_attach(struct parport *port)
 {
+	int selected_keypad_type = NOT_SET;
 	struct pardev_cb panel_cb;
 
-	if (port->number != parport)
-		return;
-
-	if (pprt) {
-		pr_err("%s: port->number=%d parport=%d, already registered!\n",
-		       __func__, port->number, parport);
-		return;
-	}
-
-	memset(&panel_cb, 0, sizeof(panel_cb));
-	panel_cb.private = &pprt;
-	/* panel_cb.flags = 0 should be PARPORT_DEV_EXCL? */
-
-	pprt = parport_register_dev_model(port, "panel", &panel_cb, 0);
-	if (!pprt) {
-		pr_err("%s: port->number=%d parport=%d, parport_register_device() failed\n",
-		       __func__, port->number, parport);
-		return;
-	}
-
-	if (parport_claim(pprt)) {
-		pr_err("could not claim access to parport%d. Aborting.\n",
-		       parport);
-		goto err_unreg_device;
-	}
-
-	/* must init LCD first, just in case an IRQ from the keypad is
-	 * generated at keypad init
-	 */
-	if (lcd.enabled) {
-		lcd_init();
-		if (!lcd.charlcd || charlcd_register(lcd.charlcd))
-			goto err_unreg_device;
-	}
-
-	if (keypad.enabled) {
-		keypad_init();
-		if (misc_register(&keypad_dev))
-			goto err_lcd_unreg;
-	}
-	return;
-
-err_lcd_unreg:
-	if (scan_timer.function)
-		del_timer_sync(&scan_timer);
-	if (lcd.enabled)
-		charlcd_unregister(lcd.charlcd);
-err_unreg_device:
-	kfree(lcd.charlcd);
-	lcd.charlcd = NULL;
-	parport_unregister_device(pprt);
-	pprt = NULL;
-}
-
-static void panel_detach(struct parport *port)
-{
-	if (port->number != parport)
-		return;
-
-	if (!pprt) {
-		pr_err("%s: port->number=%d parport=%d, nothing to unregister.\n",
-		       __func__, port->number, parport);
-		return;
-	}
-	if (scan_timer.function)
-		del_timer_sync(&scan_timer);
-
-	if (keypad.enabled) {
-		misc_deregister(&keypad_dev);
-		keypad_initialized = 0;
-	}
-
-	if (lcd.enabled) {
-		charlcd_unregister(lcd.charlcd);
-		lcd.initialized = false;
-		kfree(lcd.charlcd->drvdata);
-		kfree(lcd.charlcd);
-		lcd.charlcd = NULL;
-	}
-
-	/* TODO: free all input signals */
-	parport_release(pprt);
-	parport_unregister_device(pprt);
-	pprt = NULL;
-}
-
-static struct parport_driver panel_driver = {
-	.name = "panel",
-	.match_port = panel_attach,
-	.detach = panel_detach,
-	.devmodel = true,
-};
-
-/* init function */
-static int __init panel_init_module(void)
-{
-	int selected_keypad_type = NOT_SET, err;
-
 	/* take care of an eventual profile */
 	switch (profile) {
 	case PANEL_PROFILE_CUSTOM:
@@ -1714,26 +1617,99 @@ static int __init panel_init_module(void)
 		return -ENODEV;
 	}
 
-	err = parport_register_driver(&panel_driver);
-	if (err) {
-		pr_err("could not register with parport. Aborting.\n");
-		return err;
+	if (port->number != parport)
+		return;
+
+	if (pprt) {
+		pr_err("%s: port->number=%d parport=%d, already registered!\n",
+		       __func__, port->number, parport);
+		return;
 	}
 
-	if (pprt)
-		pr_info("panel driver registered on parport%d (io=0x%lx).\n",
-			parport, pprt->port->base);
-	else
-		pr_info("panel driver not yet registered\n");
-	return 0;
+	memset(&panel_cb, 0, sizeof(panel_cb));
+	panel_cb.private = &pprt;
+	/* panel_cb.flags = 0 should be PARPORT_DEV_EXCL? */
+
+	pprt = parport_register_dev_model(port, "panel", &panel_cb, 0);
+	if (!pprt) {
+		pr_err("%s: port->number=%d parport=%d, parport_register_device() failed\n",
+		       __func__, port->number, parport);
+		return;
+	}
+
+	if (parport_claim(pprt)) {
+		pr_err("could not claim access to parport%d. Aborting.\n",
+		       parport);
+		goto err_unreg_device;
+	}
+
+	/* must init LCD first, just in case an IRQ from the keypad is
+	 * generated at keypad init
+	 */
+	if (lcd.enabled) {
+		lcd_init();
+		if (!lcd.charlcd || charlcd_register(lcd.charlcd))
+			goto err_unreg_device;
+	}
+
+	if (keypad.enabled) {
+		keypad_init();
+		if (misc_register(&keypad_dev))
+			goto err_lcd_unreg;
+	}
+	return;
+
+err_lcd_unreg:
+	if (scan_timer.function)
+		del_timer_sync(&scan_timer);
+	if (lcd.enabled)
+		charlcd_unregister(lcd.charlcd);
+err_unreg_device:
+	kfree(lcd.charlcd);
+	lcd.charlcd = NULL;
+	parport_unregister_device(pprt);
+	pprt = NULL;
 }
 
-static void __exit panel_cleanup_module(void)
+static void panel_detach(struct parport *port)
 {
-	parport_unregister_driver(&panel_driver);
+	if (port->number != parport)
+		return;
+
+	if (!pprt) {
+		pr_err("%s: port->number=%d parport=%d, nothing to unregister.\n",
+		       __func__, port->number, parport);
+		return;
+	}
+	if (scan_timer.function)
+		del_timer_sync(&scan_timer);
+
+	if (keypad.enabled) {
+		misc_deregister(&keypad_dev);
+		keypad_initialized = 0;
+	}
+
+	if (lcd.enabled) {
+		charlcd_unregister(lcd.charlcd);
+		lcd.initialized = false;
+		kfree(lcd.charlcd->drvdata);
+		kfree(lcd.charlcd);
+		lcd.charlcd = NULL;
+	}
+
+	/* TODO: free all input signals */
+	parport_release(pprt);
+	parport_unregister_device(pprt);
+	pprt = NULL;
 }
 
-module_init(panel_init_module);
-module_exit(panel_cleanup_module);
+static struct parport_driver panel_driver = {
+	.name = "panel",
+	.match_port = panel_attach,
+	.detach = panel_detach,
+	.devmodel = true,
+};
+module_parport_driver(panel_driver);
+
 MODULE_AUTHOR("Willy Tarreau");
 MODULE_LICENSE("GPL");
-- 
2.30.2


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

* Re: [PATCH v1 1/1] auxdisplay: panel: Switch to use module_parport_driver()
  2021-06-16 14:20 [PATCH v1 1/1] auxdisplay: panel: Switch to use module_parport_driver() Andy Shevchenko
@ 2021-06-21 20:13 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-06-21 20:13 UTC (permalink / raw)
  To: Andy Shevchenko, Miguel Ojeda, Lars Poeschel, linux-kernel
  Cc: kbuild-all, clang-built-linux, Willy Tarreau, Ksenija Stanojevic,
	Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 24859 bytes --]

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.13-rc7 next-20210621]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/auxdisplay-panel-Switch-to-use-module_parport_driver/20210617-050100
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6b00bc639f1f2beeff3595e1bab9faaa51d23b01
config: powerpc-randconfig-r016-20210621 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project e1adf90826a57b674eee79b071fb46c1f5683cd0)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://github.com/0day-ci/linux/commit/e05c6842e04754d31229738b77ce7166b2fa15c8
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/auxdisplay-panel-Switch-to-use-module_parport_driver/20210617-050100
        git checkout e05c6842e04754d31229738b77ce7166b2fa15c8
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   __do_insb
   ^
   arch/powerpc/include/asm/io.h:556:56: note: expanded from macro '__do_insb'
   #define __do_insb(p, b, n)      readsb((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/auxdisplay/panel.c:43:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:122:1: note: expanded from here
   __do_insw
   ^
   arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
   #define __do_insw(p, b, n)      readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/auxdisplay/panel.c:43:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:124:1: note: expanded from here
   __do_insl
   ^
   arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
   #define __do_insl(p, b, n)      readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/auxdisplay/panel.c:43:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:126:1: note: expanded from here
   __do_outsb
   ^
   arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
   #define __do_outsb(p, b, n)     writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/auxdisplay/panel.c:43:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:128:1: note: expanded from here
   __do_outsw
   ^
   arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
   #define __do_outsw(p, b, n)     writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/auxdisplay/panel.c:43:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:130:1: note: expanded from here
   __do_outsl
   ^
   arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
   #define __do_outsl(p, b, n)     writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
>> drivers/auxdisplay/panel.c:1617:3: error: void function 'panel_attach' should not return a value [-Wreturn-type]
                   return -ENODEV;
                   ^      ~~~~~~~
   13 warnings and 1 error generated.


vim +/panel_attach +1617 drivers/auxdisplay/panel.c

7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1520  
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1521  static void panel_attach(struct parport *port)
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1522  {
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1523  	int selected_keypad_type = NOT_SET;
9be83c0a44de0c59 drivers/staging/panel/panel.c Sudip Mukherjee    2015-05-20  1524  	struct pardev_cb panel_cb;
9be83c0a44de0c59 drivers/staging/panel/panel.c Sudip Mukherjee    2015-05-20  1525  
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1526  	/* take care of an eventual profile */
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1527  	switch (profile) {
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1528  	case PANEL_PROFILE_CUSTOM:
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1529  		/* custom profile */
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1530  		selected_keypad_type = DEFAULT_KEYPAD_TYPE;
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1531  		selected_lcd_type = DEFAULT_LCD_TYPE;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1532  		break;
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1533  	case PANEL_PROFILE_OLD:
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1534  		/* 8 bits, 2*16, old keypad */
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1535  		selected_keypad_type = KEYPAD_TYPE_OLD;
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1536  		selected_lcd_type = LCD_TYPE_OLD;
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1537  
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1538  		/* TODO: This two are a little hacky, sort it out later */
2d35bcf66c61d696 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1539  		if (lcd_width == NOT_SET)
698b1515f0391438 drivers/staging/panel/panel.c Willy Tarreau      2008-11-22  1540  			lcd_width = 16;
2d35bcf66c61d696 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1541  		if (lcd_hwidth == NOT_SET)
698b1515f0391438 drivers/staging/panel/panel.c Willy Tarreau      2008-11-22  1542  			lcd_hwidth = 16;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1543  		break;
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1544  	case PANEL_PROFILE_NEW:
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1545  		/* serial, 2*16, new keypad */
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1546  		selected_keypad_type = KEYPAD_TYPE_NEW;
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1547  		selected_lcd_type = LCD_TYPE_KS0074;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1548  		break;
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1549  	case PANEL_PROFILE_HANTRONIX:
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1550  		/* 8 bits, 2*16 hantronix-like, no keypad */
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1551  		selected_keypad_type = KEYPAD_TYPE_NONE;
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1552  		selected_lcd_type = LCD_TYPE_HANTRONIX;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1553  		break;
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1554  	case PANEL_PROFILE_NEXCOM:
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1555  		/* generic 8 bits, 2*16, nexcom keypad, eg. Nexcom. */
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1556  		selected_keypad_type = KEYPAD_TYPE_NEXCOM;
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1557  		selected_lcd_type = LCD_TYPE_NEXCOM;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1558  		break;
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1559  	case PANEL_PROFILE_LARGE:
429ccf058bc20173 drivers/staging/panel/panel.c Henri Häkkinen     2010-06-12  1560  		/* 8 bits, 2*40, old keypad */
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1561  		selected_keypad_type = KEYPAD_TYPE_OLD;
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1562  		selected_lcd_type = LCD_TYPE_OLD;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1563  		break;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1564  	}
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1565  
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1566  	/*
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1567  	 * Overwrite selection with module param values (both keypad and lcd),
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1568  	 * where the deprecated params have lower prio.
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1569  	 */
1a4b2e3e6c65655c drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1570  	if (keypad_enabled != NOT_SET)
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1571  		selected_keypad_type = keypad_enabled;
1a4b2e3e6c65655c drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1572  	if (keypad_type != NOT_SET)
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1573  		selected_keypad_type = keypad_type;
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1574  
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1575  	keypad.enabled = (selected_keypad_type > 0);
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1576  
1a4b2e3e6c65655c drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1577  	if (lcd_enabled != NOT_SET)
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1578  		selected_lcd_type = lcd_enabled;
1a4b2e3e6c65655c drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1579  	if (lcd_type != NOT_SET)
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1580  		selected_lcd_type = lcd_type;
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1581  
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1582  	lcd.enabled = (selected_lcd_type > 0);
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1583  
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1584  	if (lcd.enabled) {
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1585  		/*
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1586  		 * Init lcd struct with load-time values to preserve exact
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1587  		 * current functionality (at least for now).
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1588  		 */
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1589  		lcd.charset = lcd_charset;
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1590  		lcd.proto = lcd_proto;
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1591  		lcd.pins.e = lcd_e_pin;
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1592  		lcd.pins.rs = lcd_rs_pin;
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1593  		lcd.pins.rw = lcd_rw_pin;
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1594  		lcd.pins.cl = lcd_cl_pin;
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1595  		lcd.pins.da = lcd_da_pin;
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1596  		lcd.pins.bl = lcd_bl_pin;
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1597  	}
733345ec4ee37568 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-11  1598  
87b8e0c88195cfc9 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1599  	switch (selected_keypad_type) {
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1600  	case KEYPAD_TYPE_OLD:
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1601  		keypad_profile = old_keypad_profile;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1602  		break;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1603  	case KEYPAD_TYPE_NEW:
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1604  		keypad_profile = new_keypad_profile;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1605  		break;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1606  	case KEYPAD_TYPE_NEXCOM:
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1607  		keypad_profile = nexcom_keypad_profile;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1608  		break;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1609  	default:
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1610  		keypad_profile = NULL;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1611  		break;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1612  	}
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1613  
a8b2580b736746a4 drivers/staging/panel/panel.c Mariusz Gorski     2014-11-27  1614  	if (!lcd.enabled && !keypad.enabled) {
f43de77c9dddba86 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-10  1615  		/* no device enabled, let's exit */
30f468b2ea7a75aa drivers/misc/panel.c          Geert Uytterhoeven 2017-02-06  1616  		pr_err("panel driver disabled.\n");
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13 @1617  		return -ENODEV;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1618  	}
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1619  
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1620  	if (port->number != parport)
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1621  		return;
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1622  
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1623  	if (pprt) {
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1624  		pr_err("%s: port->number=%d parport=%d, already registered!\n",
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1625  		       __func__, port->number, parport);
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1626  		return;
f43de77c9dddba86 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-10  1627  	}
f43de77c9dddba86 drivers/staging/panel/panel.c Sudip Mukherjee    2015-02-10  1628  
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1629  	memset(&panel_cb, 0, sizeof(panel_cb));
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1630  	panel_cb.private = &pprt;
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1631  	/* panel_cb.flags = 0 should be PARPORT_DEV_EXCL? */
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1632  
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1633  	pprt = parport_register_dev_model(port, "panel", &panel_cb, 0);
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1634  	if (!pprt) {
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1635  		pr_err("%s: port->number=%d parport=%d, parport_register_device() failed\n",
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1636  		       __func__, port->number, parport);
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1637  		return;
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1638  	}
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1639  
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1640  	if (parport_claim(pprt)) {
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1641  		pr_err("could not claim access to parport%d. Aborting.\n",
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1642  		       parport);
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1643  		goto err_unreg_device;
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1644  	}
7005b58458e4beec drivers/staging/panel/panel.c Willy Tarreau      2008-11-13  1645  
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1646  	/* must init LCD first, just in case an IRQ from the keypad is
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1647  	 * generated at keypad init
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1648  	 */
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1649  	if (lcd.enabled) {
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1650  		lcd_init();
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1651  		if (!lcd.charlcd || charlcd_register(lcd.charlcd))
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1652  			goto err_unreg_device;
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1653  	}
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1654  
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1655  	if (keypad.enabled) {
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1656  		keypad_init();
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1657  		if (misc_register(&keypad_dev))
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1658  			goto err_lcd_unreg;
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1659  	}
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1660  	return;
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1661  
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1662  err_lcd_unreg:
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1663  	if (scan_timer.function)
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1664  		del_timer_sync(&scan_timer);
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1665  	if (lcd.enabled)
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1666  		charlcd_unregister(lcd.charlcd);
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1667  err_unreg_device:
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1668  	kfree(lcd.charlcd);
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1669  	lcd.charlcd = NULL;
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1670  	parport_unregister_device(pprt);
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1671  	pprt = NULL;
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1672  }
e05c6842e04754d3 drivers/auxdisplay/panel.c    Andy Shevchenko    2021-06-16  1673  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25331 bytes --]

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

end of thread, other threads:[~2021-06-21 20:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 14:20 [PATCH v1 1/1] auxdisplay: panel: Switch to use module_parport_driver() Andy Shevchenko
2021-06-21 20:13 ` kernel test robot

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