All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe()
@ 2018-02-07 19:47 Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 02/12] parport: ax88796: Improve a size determination " Sudip Mukherjee
                   ` (11 more replies)
  0 siblings, 12 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Markus Elfring <elfring@users.sourceforge.net>

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_ax88796.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c
index 2fc91ed..ef0aec4 100644
--- a/drivers/parport/parport_ax88796.c
+++ b/drivers/parport/parport_ax88796.c
@@ -281,10 +281,8 @@ static int parport_ax88796_probe(struct platform_device *pdev)
 	int ret;
 
 	dd = kzalloc(sizeof(struct ax_drvdata), GFP_KERNEL);
-	if (dd == NULL) {
-		dev_err(_dev, "no memory for private data\n");
+	if (!dd)
 		return -ENOMEM;
-	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (res == NULL) {
-- 
2.7.4

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

* [PATCH 02/12] parport: ax88796: Improve a size determination in parport_ax88796_probe()
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
@ 2018-02-07 19:47 ` Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 03/12] parport: ax88796: Delete an unnecessary variable initialisation " Sudip Mukherjee
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Markus Elfring <elfring@users.sourceforge.net>

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_ax88796.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c
index ef0aec4..09788d8 100644
--- a/drivers/parport/parport_ax88796.c
+++ b/drivers/parport/parport_ax88796.c
@@ -280,7 +280,7 @@ static int parport_ax88796_probe(struct platform_device *pdev)
 	int irq;
 	int ret;
 
-	dd = kzalloc(sizeof(struct ax_drvdata), GFP_KERNEL);
+	dd = kzalloc(sizeof(*dd), GFP_KERNEL);
 	if (!dd)
 		return -ENOMEM;
 
-- 
2.7.4

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

* [PATCH 03/12] parport: ax88796: Delete an unnecessary variable initialisation in parport_ax88796_probe()
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 02/12] parport: ax88796: Improve a size determination " Sudip Mukherjee
@ 2018-02-07 19:47 ` Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 04/12] parport: Add support for BrainBoxes PX272/PX306 MIO card Sudip Mukherjee
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Markus Elfring <elfring@users.sourceforge.net>

The local variable "pp" will eventually be set to an appropriate pointer
a bit later. Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_ax88796.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c
index 09788d8..bfe97c2 100644
--- a/drivers/parport/parport_ax88796.c
+++ b/drivers/parport/parport_ax88796.c
@@ -273,7 +273,7 @@ static int parport_ax88796_probe(struct platform_device *pdev)
 {
 	struct device *_dev = &pdev->dev;
 	struct ax_drvdata *dd;
-	struct parport *pp = NULL;
+	struct parport *pp;
 	struct resource *res;
 	unsigned long size;
 	int spacing;
-- 
2.7.4

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

* [PATCH 04/12] parport: Add support for BrainBoxes PX272/PX306 MIO card
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 02/12] parport: ax88796: Improve a size determination " Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 03/12] parport: ax88796: Delete an unnecessary variable initialisation " Sudip Mukherjee
@ 2018-02-07 19:47 ` Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 05/12] parport: PCI core handles power state for us Sudip Mukherjee
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

This adds support for BrainBoxes Multi I/O cards (4+1 serial + 1 parallel port):

02:00.0 0702: 135a:4100 (rev 02)
        Subsystem: 135a:0443
	Flags: fast devsel, IRQ 18
	Memory at f7d02000 (32-bit, non-prefetchable) [size=128]
	I/O ports at e000 [size=128]
	I/O ports at e080 [size=64]
	I/O ports at e0c0 [size=16]
	Memory at f7d01000 (32-bit, non-prefetchable) [size=128]
	Memory at f7d00000 (32-bit, non-prefetchable) [size=128]
	Capabilities: [50] MSI: Enable- Count=1/4 Maskable- 64bit+
	Capabilities: [78] Power Management version 3
	Capabilities: [80] Express Legacy Endpoint, MSI 01
	Capabilities: [100] Virtual Channel
	Capabilities: [800] Advanced Error Reporting

Reported-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Tested-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_serial.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index e15b484..53a3eae 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -65,6 +65,7 @@ enum parport_pc_pci_cards {
 	wch_ch353_1s1p,
 	wch_ch353_2s1p,
 	wch_ch382_2s1p,
+	brainboxes_5s1p,
 	sunix_2s1p,
 };
 
@@ -153,6 +154,7 @@ static struct parport_pc_pci cards[] = {
 	/* wch_ch353_1s1p*/             { 1, { { 1, -1}, } },
 	/* wch_ch353_2s1p*/             { 1, { { 2, -1}, } },
 	/* wch_ch382_2s1p*/             { 1, { { 2, -1}, } },
+	/* brainboxes_5s1p */           { 1, { { 3, -1 }, } },
 	/* sunix_2s1p */                { 1, { { 3, -1 }, } },
 };
 
@@ -261,6 +263,10 @@ static struct pci_device_id parport_serial_pci_tbl[] = {
 	{ 0x4348, 0x7053, 0x4348, 0x3253, 0, 0, wch_ch353_2s1p},
 	{ 0x1c00, 0x3250, 0x1c00, 0x3250, 0, 0, wch_ch382_2s1p},
 
+	/* BrainBoxes PX272/PX306 MIO card */
+	{ PCI_VENDOR_ID_INTASHIELD, 0x4100,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, brainboxes_5s1p },
+
 	/*
 	 * More SUNIX variations. At least one of these has part number
 	 * '5079A but subdevice 0x102. That board reports 0x0708 as
@@ -504,6 +510,12 @@ static struct pciserial_board pci_parport_serial_boards[] = {
 		.uart_offset    = 8,
 		.first_offset   = 0xC0,
 	},
+	[brainboxes_5s1p] = {
+		.flags		= FL_BASE2,
+		.num_ports	= 5,
+		.base_baud	= 921600,
+		.uart_offset	= 8,
+	},
 	[sunix_2s1p] = {
 		.flags		= FL_BASE0|FL_BASE_BARS,
 		.num_ports	= 2,
-- 
2.7.4

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

* [PATCH 05/12] parport: PCI core handles power state for us
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
                   ` (2 preceding siblings ...)
  2018-02-07 19:47 ` [PATCH 04/12] parport: Add support for BrainBoxes PX272/PX306 MIO card Sudip Mukherjee
@ 2018-02-07 19:47 ` Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 06/12] parport: Convert to use managed functions pcim_* and devm_* Sudip Mukherjee
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Andy Shevchenko <andy.shevchenko@gmail.com>

There is no need to repeat the work that is already done in the PCI
driver core. The patch removes excerpts from suspend and resume
callbacks.

Note that there is no more calls performed to enable or disable a PCI
device during suspend-resume cycle. Nowadays they seems to be
superflous. Someone can read more in [1].

While here, convert calls to new driver API.

[1] https://www.kernel.org/doc/ols/2009/ols2009-pages-319-330.pdf

Tested-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_serial.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index 53a3eae..d0a5bc5 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -664,57 +664,41 @@ static void parport_serial_pci_remove(struct pci_dev *dev)
 	return;
 }
 
-#ifdef CONFIG_PM
-static int parport_serial_pci_suspend(struct pci_dev *dev, pm_message_t state)
+static int __maybe_unused parport_serial_pci_suspend(struct device *dev)
 {
-	struct parport_serial_private *priv = pci_get_drvdata(dev);
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct parport_serial_private *priv = pci_get_drvdata(pdev);
 
 	if (priv->serial)
 		pciserial_suspend_ports(priv->serial);
 
 	/* FIXME: What about parport? */
-
-	pci_save_state(dev);
-	pci_set_power_state(dev, pci_choose_state(dev, state));
 	return 0;
 }
 
-static int parport_serial_pci_resume(struct pci_dev *dev)
+static int __maybe_unused parport_serial_pci_resume(struct device *dev)
 {
-	struct parport_serial_private *priv = pci_get_drvdata(dev);
-	int err;
-
-	pci_set_power_state(dev, PCI_D0);
-	pci_restore_state(dev);
-
-	/*
-	 * The device may have been disabled.  Re-enable it.
-	 */
-	err = pci_enable_device(dev);
-	if (err) {
-		printk(KERN_ERR "parport_serial: %s: error enabling "
-			"device for resume (%d)\n", pci_name(dev), err);
-		return err;
-	}
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct parport_serial_private *priv = pci_get_drvdata(pdev);
 
 	if (priv->serial)
 		pciserial_resume_ports(priv->serial);
 
 	/* FIXME: What about parport? */
-
 	return 0;
 }
-#endif
+
+static SIMPLE_DEV_PM_OPS(parport_serial_pm_ops,
+			 parport_serial_pci_suspend, parport_serial_pci_resume);
 
 static struct pci_driver parport_serial_pci_driver = {
 	.name		= "parport_serial",
 	.id_table	= parport_serial_pci_tbl,
 	.probe		= parport_serial_pci_probe,
 	.remove		= parport_serial_pci_remove,
-#ifdef CONFIG_PM
-	.suspend	= parport_serial_pci_suspend,
-	.resume		= parport_serial_pci_resume,
-#endif
+	.driver         = {
+		.pm     = &parport_serial_pm_ops,
+	},
 };
 
 
-- 
2.7.4

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

* [PATCH 06/12] parport: Convert to use managed functions pcim_* and devm_*
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
                   ` (3 preceding siblings ...)
  2018-02-07 19:47 ` [PATCH 05/12] parport: PCI core handles power state for us Sudip Mukherjee
@ 2018-02-07 19:47 ` Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 07/12] parport: Don't shadow error codes in ->probe() Sudip Mukherjee
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

This makes the error handling much more simpler than open-coding everything
and in addition makes the probe function smaller an tidier.

Tested-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_serial.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index d0a5bc5..050eeb0 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -620,27 +620,23 @@ static int parport_serial_pci_probe(struct pci_dev *dev,
 	struct parport_serial_private *priv;
 	int err;
 
-	priv = kzalloc (sizeof *priv, GFP_KERNEL);
+	priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
+
 	pci_set_drvdata (dev, priv);
 
-	err = pci_enable_device (dev);
-	if (err) {
-		kfree (priv);
+	err = pcim_enable_device(dev);
+	if (err)
 		return err;
-	}
 
-	if (parport_register (dev, id)) {
-		kfree (priv);
+	if (parport_register(dev, id))
 		return -ENODEV;
-	}
 
 	if (serial_register (dev, id)) {
 		int i;
 		for (i = 0; i < priv->num_par; i++)
 			parport_pc_unregister_port (priv->port[i]);
-		kfree (priv);
 		return -ENODEV;
 	}
 
@@ -660,7 +656,6 @@ static void parport_serial_pci_remove(struct pci_dev *dev)
 	for (i = 0; i < priv->num_par; i++)
 		parport_pc_unregister_port (priv->port[i]);
 
-	kfree (priv);
 	return;
 }
 
-- 
2.7.4

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

* [PATCH 07/12] parport: Don't shadow error codes in ->probe()
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
                   ` (4 preceding siblings ...)
  2018-02-07 19:47 ` [PATCH 06/12] parport: Convert to use managed functions pcim_* and devm_* Sudip Mukherjee
@ 2018-02-07 19:47 ` Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 08/12] parport: Convert printk(KERN_WARN) to dev_warn() Sudip Mukherjee
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

When ->probe() calls helper functions return theirs error codes
instead of shadowing them.

Tested-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_serial.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index 050eeb0..c222698 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -539,12 +539,10 @@ static int serial_register(struct pci_dev *dev, const struct pci_device_id *id)
 	struct serial_private *serial;
 
 	board = &pci_parport_serial_boards[id->driver_data];
-
 	if (board->num_ports == 0)
 		return 0;
 
 	serial = pciserial_init_ports(dev, board);
-
 	if (IS_ERR(serial))
 		return PTR_ERR(serial);
 
@@ -630,14 +628,16 @@ static int parport_serial_pci_probe(struct pci_dev *dev,
 	if (err)
 		return err;
 
-	if (parport_register(dev, id))
-		return -ENODEV;
+	err = parport_register(dev, id);
+	if (err)
+		return err;
 
-	if (serial_register (dev, id)) {
+	err = serial_register(dev, id);
+	if (err) {
 		int i;
 		for (i = 0; i < priv->num_par; i++)
 			parport_pc_unregister_port (priv->port[i]);
-		return -ENODEV;
+		return err;
 	}
 
 	return 0;
-- 
2.7.4

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

* [PATCH 08/12] parport: Convert printk(KERN_WARN) to dev_warn()
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
                   ` (5 preceding siblings ...)
  2018-02-07 19:47 ` [PATCH 07/12] parport: Don't shadow error codes in ->probe() Sudip Mukherjee
@ 2018-02-07 19:47 ` Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 09/12] parport: Switch to use module_pci_driver() macro Sudip Mukherjee
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

dev_warn() will print device name with associated driver,
no need to keep this open coded.

While here, adjust indentation in the rest of dev_dbg() calls.

Tested-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_serial.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index c222698..c56bb06 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -571,10 +571,9 @@ static int parport_register(struct pci_dev *dev, const struct pci_device_id *id)
 		int irq;
 
 		if (priv->num_par == ARRAY_SIZE (priv->port)) {
-			printk (KERN_WARNING
-				"parport_serial: %s: only %zu parallel ports "
-				"supported (%d reported)\n", pci_name (dev),
-				ARRAY_SIZE(priv->port), card->numports);
+			dev_warn(&dev->dev,
+				 "only %zu parallel ports supported (%d reported)\n",
+				 ARRAY_SIZE(priv->port), card->numports);
 			break;
 		}
 
@@ -590,12 +589,12 @@ static int parport_register(struct pci_dev *dev, const struct pci_device_id *id)
 		irq = dev->irq;
 		if (irq == IRQ_NONE) {
 			dev_dbg(&dev->dev,
-			"PCI parallel port detected: I/O at %#lx(%#lx)\n",
+				"PCI parallel port detected: I/O at %#lx(%#lx)\n",
 				io_lo, io_hi);
 			irq = PARPORT_IRQ_NONE;
 		} else {
 			dev_dbg(&dev->dev,
-		"PCI parallel port detected: I/O at %#lx(%#lx), IRQ %d\n",
+				"PCI parallel port detected: I/O at %#lx(%#lx), IRQ %d\n",
 				io_lo, io_hi, irq);
 		}
 		port = parport_pc_probe_port (io_lo, io_hi, irq,
-- 
2.7.4

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

* [PATCH 09/12] parport: Switch to use module_pci_driver() macro
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
                   ` (6 preceding siblings ...)
  2018-02-07 19:47 ` [PATCH 08/12] parport: Convert printk(KERN_WARN) to dev_warn() Sudip Mukherjee
@ 2018-02-07 19:47 ` Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 10/12] parport: Sort headers alphabetically Sudip Mukherjee
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Eliminate some boilerplate code by using module_pci_driver() instead of
init/exit, moving the salient bits from init into probe.

Tested-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_serial.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index c56bb06..08e218e 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -694,22 +694,8 @@ static struct pci_driver parport_serial_pci_driver = {
 		.pm     = &parport_serial_pm_ops,
 	},
 };
-
-
-static int __init parport_serial_init (void)
-{
-	return pci_register_driver (&parport_serial_pci_driver);
-}
-
-static void __exit parport_serial_exit (void)
-{
-	pci_unregister_driver (&parport_serial_pci_driver);
-	return;
-}
+module_pci_driver(parport_serial_pci_driver);
 
 MODULE_AUTHOR("Tim Waugh <twaugh@redhat.com>");
 MODULE_DESCRIPTION("Driver for common parallel+serial multi-I/O PCI cards");
 MODULE_LICENSE("GPL");
-
-module_init(parport_serial_init);
-module_exit(parport_serial_exit);
-- 
2.7.4

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

* [PATCH 10/12] parport: Sort headers alphabetically
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
                   ` (7 preceding siblings ...)
  2018-02-07 19:47 ` [PATCH 09/12] parport: Switch to use module_pci_driver() macro Sudip Mukherjee
@ 2018-02-07 19:47 ` Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 11/12] parport: Replace short License header by SPDX identifier Sudip Mukherjee
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

While here, remove init.h inclusion since we are not using it directly and
module.h will do this for us.

No functional changes intended.

Tested-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_serial.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index 08e218e..d141e31 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -17,14 +17,14 @@
  *
  */
 
-#include <linux/types.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/pci.h>
 #include <linux/interrupt.h>
+#include <linux/module.h>
 #include <linux/parport.h>
 #include <linux/parport_pc.h>
+#include <linux/pci.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+
 #include <linux/8250_pci.h>
 
 enum parport_pc_pci_cards {
-- 
2.7.4

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

* [PATCH 11/12] parport: Replace short License header by SPDX identifier
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
                   ` (8 preceding siblings ...)
  2018-02-07 19:47 ` [PATCH 10/12] parport: Sort headers alphabetically Sudip Mukherjee
@ 2018-02-07 19:47 ` Sudip Mukherjee
  2018-02-07 19:47 ` [PATCH 12/12] parport_pc: Add support for WCH CH382L PCI-E single parallel port card Sudip Mukherjee
  2018-03-01 10:46 ` [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Andy Shevchenko
  11 siblings, 0 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

No functional changes involved.

Tested-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_serial.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index d141e31..4f8b260 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -1,20 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Support for common PCI multi-I/O cards (which is most of them)
  *
  * Copyright (C) 2001  Tim Waugh <twaugh@redhat.com>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- *
  * Multi-function PCI cards are supposed to present separate logical
  * devices on the bus.  A common thing to do seems to be to just use
  * one logical device with lots of base address registers for both
  * parallel ports and serial ports.  This driver is for dealing with
  * that.
- *
  */
 
 #include <linux/interrupt.h>
-- 
2.7.4

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

* [PATCH 12/12] parport_pc: Add support for WCH CH382L PCI-E single parallel port card.
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
                   ` (9 preceding siblings ...)
  2018-02-07 19:47 ` [PATCH 11/12] parport: Replace short License header by SPDX identifier Sudip Mukherjee
@ 2018-02-07 19:47 ` Sudip Mukherjee
  2018-03-01 10:46 ` [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Andy Shevchenko
  11 siblings, 0 replies; 17+ messages in thread
From: Sudip Mukherjee @ 2018-02-07 19:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sudip Mukherjee

From: Alexander Gerasiov <gq@redlab-i.ru>

WCH CH382L is a PCI-E adapter with 1 parallel port. It is similair to CH382
but serial ports are not soldered on board. Detected as
Serial controller: Device 1c00:3050 (rev 10) (prog-if 05 [16850])

Signed-off-by: Alexander Gerasiov <gq@redlab-i.ru>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/parport/parport_pc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 489492b..aa6bb50 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2646,6 +2646,7 @@ enum parport_pc_pci_cards {
 	netmos_9901,
 	netmos_9865,
 	quatech_sppxp100,
+	wch_ch382l,
 };
 
 
@@ -2708,6 +2709,7 @@ static struct parport_pc_pci {
 	/* netmos_9901 */               { 1, { { 0, -1 }, } },
 	/* netmos_9865 */               { 1, { { 0, -1 }, } },
 	/* quatech_sppxp100 */		{ 1, { { 0, 1 }, } },
+	/* wch_ch382l */		{ 1, { { 2, -1 }, } },
 };
 
 static const struct pci_device_id parport_pc_pci_tbl[] = {
@@ -2797,6 +2799,8 @@ static const struct pci_device_id parport_pc_pci_tbl[] = {
 	/* Quatech SPPXP-100 Parallel port PCI ExpressCard */
 	{ PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
+	/* WCH CH382L PCI-E single parallel port card */
+	{ 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382l},
 	{ 0, } /* terminate list */
 };
 MODULE_DEVICE_TABLE(pci, parport_pc_pci_tbl);
-- 
2.7.4

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

* Re: [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe()
  2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
                   ` (10 preceding siblings ...)
  2018-02-07 19:47 ` [PATCH 12/12] parport_pc: Add support for WCH CH382L PCI-E single parallel port card Sudip Mukherjee
@ 2018-03-01 10:46 ` Andy Shevchenko
  2018-03-01 12:06   ` Greg Kroah-Hartman
  11 siblings, 1 reply; 17+ messages in thread
From: Andy Shevchenko @ 2018-03-01 10:46 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Greg Kroah-Hartman, Linux Kernel Mailing List

On Wed, Feb 7, 2018 at 9:47 PM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
>
> Omit an extra message for a memory allocation failure in this function.
>
> This issue was detected by using the Coccinelle software.
>

Greg, just to be sure this series is under your scope.
IIRC it had been sent during merge window, though it looks like your
tty tree doesn't include it yet, while even older patches, which were
sent as well during merge window, made it

> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
>  drivers/parport/parport_ax88796.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c
> index 2fc91ed..ef0aec4 100644
> --- a/drivers/parport/parport_ax88796.c
> +++ b/drivers/parport/parport_ax88796.c
> @@ -281,10 +281,8 @@ static int parport_ax88796_probe(struct platform_device *pdev)
>         int ret;
>
>         dd = kzalloc(sizeof(struct ax_drvdata), GFP_KERNEL);
> -       if (dd == NULL) {
> -               dev_err(_dev, "no memory for private data\n");
> +       if (!dd)
>                 return -ENOMEM;
> -       }
>
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         if (res == NULL) {
> --
> 2.7.4
>



-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe()
  2018-03-01 10:46 ` [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Andy Shevchenko
@ 2018-03-01 12:06   ` Greg Kroah-Hartman
  2018-03-01 12:17     ` Andy Shevchenko
  2018-03-03 21:00     ` Sudip Mukherjee
  0 siblings, 2 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-03-01 12:06 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Sudip Mukherjee, Linux Kernel Mailing List

On Thu, Mar 01, 2018 at 12:46:07PM +0200, Andy Shevchenko wrote:
> On Wed, Feb 7, 2018 at 9:47 PM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> >
> > Omit an extra message for a memory allocation failure in this function.
> >
> > This issue was detected by using the Coccinelle software.
> >
> 
> Greg, just to be sure this series is under your scope.
> IIRC it had been sent during merge window, though it looks like your
> tty tree doesn't include it yet, while even older patches, which were
> sent as well during merge window, made it

It's in my large "to-review" queue...

Personally, stuff like this, from this specific developer, ends up at
the bottom of that list as well...

greg k-h

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

* Re: [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe()
  2018-03-01 12:06   ` Greg Kroah-Hartman
@ 2018-03-01 12:17     ` Andy Shevchenko
  2018-03-03 21:00     ` Sudip Mukherjee
  1 sibling, 0 replies; 17+ messages in thread
From: Andy Shevchenko @ 2018-03-01 12:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Sudip Mukherjee, Linux Kernel Mailing List

On Thu, Mar 1, 2018 at 2:06 PM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Thu, Mar 01, 2018 at 12:46:07PM +0200, Andy Shevchenko wrote:
>> On Wed, Feb 7, 2018 at 9:47 PM, Sudip Mukherjee
>> <sudipm.mukherjee@gmail.com> wrote:
>> > From: Markus Elfring <elfring@users.sourceforge.net>
>> >
>> > Omit an extra message for a memory allocation failure in this function.
>> >
>> > This issue was detected by using the Coccinelle software.
>> >
>>
>> Greg, just to be sure this series is under your scope.
>> IIRC it had been sent during merge window, though it looks like your
>> tty tree doesn't include it yet, while even older patches, which were
>> sent as well during merge window, made it
>
> It's in my large "to-review" queue...

Ah, sorry to bother then!

> Personally, stuff like this, from this specific developer, ends up at
> the bottom of that list as well...

Thanks for clarification.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe()
  2018-03-01 12:06   ` Greg Kroah-Hartman
  2018-03-01 12:17     ` Andy Shevchenko
@ 2018-03-03 21:00     ` Sudip Mukherjee
  2018-03-12 14:10       ` Andy Shevchenko
  1 sibling, 1 reply; 17+ messages in thread
From: Sudip Mukherjee @ 2018-03-03 21:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Andy Shevchenko, Linux Kernel Mailing List

Hi Greg,

On Thu, Mar 01, 2018 at 01:06:09PM +0100, Greg Kroah-Hartman wrote:
> On Thu, Mar 01, 2018 at 12:46:07PM +0200, Andy Shevchenko wrote:
> > On Wed, Feb 7, 2018 at 9:47 PM, Sudip Mukherjee
> > <sudipm.mukherjee@gmail.com> wrote:
> > > From: Markus Elfring <elfring@users.sourceforge.net>
> > >
> > > Omit an extra message for a memory allocation failure in this function.
> > >
> > > This issue was detected by using the Coccinelle software.
> > >
> > 
> > Greg, just to be sure this series is under your scope.
> > IIRC it had been sent during merge window, though it looks like your
> > tty tree doesn't include it yet, while even older patches, which were
> > sent as well during merge window, made it
> 
> It's in my large "to-review" queue...
> 
> Personally, stuff like this, from this specific developer, ends up at
> the bottom of that list as well...

do you want me to reorganize the series and resend?
I can send patches 1 - 3 later.

--
Regards
Sudip

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

* Re: [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe()
  2018-03-03 21:00     ` Sudip Mukherjee
@ 2018-03-12 14:10       ` Andy Shevchenko
  0 siblings, 0 replies; 17+ messages in thread
From: Andy Shevchenko @ 2018-03-12 14:10 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Greg Kroah-Hartman, Linux Kernel Mailing List

On Sat, Mar 3, 2018 at 11:00 PM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
> Hi Greg,
>
> On Thu, Mar 01, 2018 at 01:06:09PM +0100, Greg Kroah-Hartman wrote:
>> On Thu, Mar 01, 2018 at 12:46:07PM +0200, Andy Shevchenko wrote:
>> > On Wed, Feb 7, 2018 at 9:47 PM, Sudip Mukherjee
>> > <sudipm.mukherjee@gmail.com> wrote:
>> > > From: Markus Elfring <elfring@users.sourceforge.net>
>> > >
>> > > Omit an extra message for a memory allocation failure in this function.
>> > >
>> > > This issue was detected by using the Coccinelle software.
>> > >
>> >
>> > Greg, just to be sure this series is under your scope.
>> > IIRC it had been sent during merge window, though it looks like your
>> > tty tree doesn't include it yet, while even older patches, which were
>> > sent as well during merge window, made it
>>
>> It's in my large "to-review" queue...
>>
>> Personally, stuff like this, from this specific developer, ends up at
>> the bottom of that list as well...
>
> do you want me to reorganize the series and resend?
> I can send patches 1 - 3 later.

Greg, this series contains patches from two developers, the patches
starting from #4 is more important since they are enabling BrainBox
multi I/O cards while cleaning up the partport_serial driver itself.
I understand you have a long queue, but would we have a chance to get
into v4.17 with these?

-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2018-03-12 14:10 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-07 19:47 [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Sudip Mukherjee
2018-02-07 19:47 ` [PATCH 02/12] parport: ax88796: Improve a size determination " Sudip Mukherjee
2018-02-07 19:47 ` [PATCH 03/12] parport: ax88796: Delete an unnecessary variable initialisation " Sudip Mukherjee
2018-02-07 19:47 ` [PATCH 04/12] parport: Add support for BrainBoxes PX272/PX306 MIO card Sudip Mukherjee
2018-02-07 19:47 ` [PATCH 05/12] parport: PCI core handles power state for us Sudip Mukherjee
2018-02-07 19:47 ` [PATCH 06/12] parport: Convert to use managed functions pcim_* and devm_* Sudip Mukherjee
2018-02-07 19:47 ` [PATCH 07/12] parport: Don't shadow error codes in ->probe() Sudip Mukherjee
2018-02-07 19:47 ` [PATCH 08/12] parport: Convert printk(KERN_WARN) to dev_warn() Sudip Mukherjee
2018-02-07 19:47 ` [PATCH 09/12] parport: Switch to use module_pci_driver() macro Sudip Mukherjee
2018-02-07 19:47 ` [PATCH 10/12] parport: Sort headers alphabetically Sudip Mukherjee
2018-02-07 19:47 ` [PATCH 11/12] parport: Replace short License header by SPDX identifier Sudip Mukherjee
2018-02-07 19:47 ` [PATCH 12/12] parport_pc: Add support for WCH CH382L PCI-E single parallel port card Sudip Mukherjee
2018-03-01 10:46 ` [PATCH 01/12] parport: ax88796: Delete an error message for a failed memory allocation in parport_ax88796_probe() Andy Shevchenko
2018-03-01 12:06   ` Greg Kroah-Hartman
2018-03-01 12:17     ` Andy Shevchenko
2018-03-03 21:00     ` Sudip Mukherjee
2018-03-12 14:10       ` Andy Shevchenko

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.