linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] parport: parport_pc: PCI SIO access should also depend on SIO option
@ 2016-04-20  7:39 Sudip Mukherjee
  2016-04-30 20:56 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Sudip Mukherjee @ 2016-04-20  7:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-parport, Maciej S. Szmigiero

From: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>

CONFIG_PARPORT_PC_SUPERIO toggles Super IO chip support in parport_pc
code, however only code accessing SIO chip via ISA (or LPC) bus was
conditional on it.

This patch makes SIO chip accesses via PCI bus also dependent on this
config option.

It should be noted that Super IO support in parport_pc is needed only when
firmware has failed to make parallel port available either via PNP or
on standard I/O ranges and user has one of a few supported SIOs.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
---

Hi Greg,
This patch is not tested on any superio chip based hardware. (I also
don't have one).
http://www.spinics.net/lists/kernel/msg2227051.html

I know you dislike adding #ifdef so its upto you.


 drivers/parport/parport_pc.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 78530d1..b241fb0 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2301,6 +2301,7 @@ EXPORT_SYMBOL(parport_pc_unregister_port);
 
 #ifdef CONFIG_PCI
 
+#ifdef CONFIG_PARPORT_PC_SUPERIO
 /* ITE support maintained by Rich Liu <richliu@poorman.org> */
 static int sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, int autodma,
 			      const struct parport_pc_via_data *via)
@@ -2611,6 +2612,9 @@ static struct parport_pc_superio {
 	{ sio_via_probe, &via_8231_data, },
 	{ sio_ite_8872_probe, NULL, },
 };
+#else
+#define last_sio 0
+#endif /* CONFIG_PARPORT_PC_SUPERIO */
 
 enum parport_pc_pci_cards {
 	siig_1p_10x = last_sio,
@@ -2711,11 +2715,13 @@ static struct parport_pc_pci {
 };
 
 static const struct pci_device_id parport_pc_pci_tbl[] = {
+#ifdef CONFIG_PARPORT_PC_SUPERIO
 	/* Super-IO onboard chips */
 	{ 0x1106, 0x0686, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sio_via_686a },
 	{ 0x1106, 0x8231, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sio_via_8231 },
 	{ PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8872,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, sio_ite_8872 },
+#endif
 
 	/* PCI cards */
 	{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1P_10x,
@@ -2900,7 +2906,11 @@ static struct pci_driver parport_pc_pci_driver = {
 	.probe		= parport_pc_pci_probe,
 	.remove		= parport_pc_pci_remove,
 };
+#else
+static struct pci_driver parport_pc_pci_driver;
+#endif /* CONFIG_PCI */
 
+#if defined(CONFIG_PCI) && defined(CONFIG_PARPORT_PC_SUPERIO)
 static int __init parport_pc_init_superio(int autoirq, int autodma)
 {
 	const struct pci_device_id *id;
@@ -2922,12 +2932,11 @@ static int __init parport_pc_init_superio(int autoirq, int autodma)
 	return ret; /* number of devices found */
 }
 #else
-static struct pci_driver parport_pc_pci_driver;
 static int __init parport_pc_init_superio(int autoirq, int autodma)
 {
 	return 0;
 }
-#endif /* CONFIG_PCI */
+#endif
 
 #ifdef CONFIG_PNP
 
@@ -3125,7 +3134,7 @@ static int __init parport_parse_dma(const char *dmastr, int *val)
 				     PARPORT_DMA_NONE, PARPORT_DMA_NOFIFO);
 }
 
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && defined(CONFIG_PARPORT_PC_SUPERIO)
 static int __init parport_init_mode_setup(char *str)
 {
 	printk(KERN_DEBUG
@@ -3162,7 +3171,7 @@ module_param_array(dma, charp, NULL, 0);
 MODULE_PARM_DESC(verbose_probing, "Log chit-chat during initialisation");
 module_param(verbose_probing, int, 0644);
 #endif
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && defined(CONFIG_PARPORT_PC_SUPERIO)
 static char *init_mode;
 MODULE_PARM_DESC(init_mode,
 	"Initialise mode for VIA VT8231 port (spp, ps2, epp, ecp or ecpepp)");
@@ -3174,7 +3183,7 @@ static int __init parse_parport_params(void)
 	unsigned int i;
 	int val;
 
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && defined(CONFIG_PARPORT_PC_SUPERIO)
 	if (init_mode)
 		parport_init_mode_setup(init_mode);
 #endif
@@ -3292,7 +3301,7 @@ __setup("parport=", parport_setup);
  *
  * parport_init_mode=[spp|ps2|epp|ecp|ecpepp]
  */
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && defined(CONFIG_PARPORT_PC_SUPERIO)
 __setup("parport_init_mode=", parport_init_mode_setup);
 #endif
 #endif
-- 
1.9.1

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

* Re: [PATCH] parport: parport_pc: PCI SIO access should also depend on SIO option
  2016-04-20  7:39 [PATCH] parport: parport_pc: PCI SIO access should also depend on SIO option Sudip Mukherjee
@ 2016-04-30 20:56 ` Greg Kroah-Hartman
  2016-05-01  7:45   ` Sudip Mukherjee
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2016-04-30 20:56 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: linux-kernel, linux-parport, Maciej S. Szmigiero

On Wed, Apr 20, 2016 at 01:09:51PM +0530, Sudip Mukherjee wrote:
> From: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
> 
> CONFIG_PARPORT_PC_SUPERIO toggles Super IO chip support in parport_pc
> code, however only code accessing SIO chip via ISA (or LPC) bus was
> conditional on it.
> 
> This patch makes SIO chip accesses via PCI bus also dependent on this
> config option.
> 
> It should be noted that Super IO support in parport_pc is needed only when
> firmware has failed to make parallel port available either via PNP or
> on standard I/O ranges and user has one of a few supported SIOs.
> 
> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
> ---
> 
> Hi Greg,
> This patch is not tested on any superio chip based hardware. (I also
> don't have one).
> http://www.spinics.net/lists/kernel/msg2227051.html
> 
> I know you dislike adding #ifdef so its upto you.

It's really a messy patch, surely there is a better solution.

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

* Re: [PATCH] parport: parport_pc: PCI SIO access should also depend on SIO option
  2016-04-30 20:56 ` Greg Kroah-Hartman
@ 2016-05-01  7:45   ` Sudip Mukherjee
  2016-05-01 14:07     ` Maciej S. Szmigiero
  0 siblings, 1 reply; 6+ messages in thread
From: Sudip Mukherjee @ 2016-05-01  7:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-parport, Maciej S. Szmigiero

On Sat, Apr 30, 2016 at 01:56:40PM -0700, Greg Kroah-Hartman wrote:
> On Wed, Apr 20, 2016 at 01:09:51PM +0530, Sudip Mukherjee wrote:
> > From: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
> > 
> > CONFIG_PARPORT_PC_SUPERIO toggles Super IO chip support in parport_pc
> > code, however only code accessing SIO chip via ISA (or LPC) bus was
> > conditional on it.
> > 
> > This patch makes SIO chip accesses via PCI bus also dependent on this
> > config option.
> > 
> > It should be noted that Super IO support in parport_pc is needed only when
> > firmware has failed to make parallel port available either via PNP or
> > on standard I/O ranges and user has one of a few supported SIOs.
> > 
> > Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
> > ---
> > 
> > Hi Greg,
> > This patch is not tested on any superio chip based hardware. (I also
> > don't have one).
> > http://www.spinics.net/lists/kernel/msg2227051.html
> > 
> > I know you dislike adding #ifdef so its upto you.
> 
> It's really a messy patch, surely there is a better solution.

yes, might be. But without hardware, should i dare?

regards
sudip

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

* Re: [PATCH] parport: parport_pc: PCI SIO access should also depend on SIO option
  2016-05-01  7:45   ` Sudip Mukherjee
@ 2016-05-01 14:07     ` Maciej S. Szmigiero
  2016-05-01 19:46       ` Sudip Mukherjee
  0 siblings, 1 reply; 6+ messages in thread
From: Maciej S. Szmigiero @ 2016-05-01 14:07 UTC (permalink / raw)
  To: Sudip Mukherjee, Greg Kroah-Hartman; +Cc: linux-kernel, linux-parport

Hi Greg,
Hi Sudip,

On 01.05.2016 09:45, Sudip Mukherjee wrote:
> On Sat, Apr 30, 2016 at 01:56:40PM -0700, Greg Kroah-Hartman wrote:
>> On Wed, Apr 20, 2016 at 01:09:51PM +0530, Sudip Mukherjee wrote:
>>> From: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
>>>
>>> CONFIG_PARPORT_PC_SUPERIO toggles Super IO chip support in parport_pc
>>> code, however only code accessing SIO chip via ISA (or LPC) bus was
>>> conditional on it.
>>>
>>> This patch makes SIO chip accesses via PCI bus also dependent on this
>>> config option.
>>>
>>> It should be noted that Super IO support in parport_pc is needed only when
>>> firmware has failed to make parallel port available either via PNP or
>>> on standard I/O ranges and user has one of a few supported SIOs.
>>>
>>> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
>>> ---
>>>
>>> Hi Greg,
>>> This patch is not tested on any superio chip based hardware. (I also
>>> don't have one).
>>> http://www.spinics.net/lists/kernel/msg2227051.html
>>>
>>> I know you dislike adding #ifdef so its upto you.
>>
>> It's really a messy patch, surely there is a better solution.
> 
> yes, might be. But without hardware, should i dare?

Well, an easy replacement of this patch would be to simply add
information to CONFIG_PARPORT_PC_SUPERIO prompt that it only applies to
accessing SIO chip via ISA/LPC bus and not PCI bus.

However, I think an intent of this config option was to disable such
probes altogether (because they are needed only on legacy hardware where
firmware didn't make parallel port available either via PNP or on
standard I/O ranges and the prompt actually suggest saying 'N' to this
option).

As existing PCI SIO probe code was already dependent on CONFIG_PCI adding
additional dependency on CONFIG_PARPORT_PC_SUPERIO was the simplest
solution.

Other possibility that comes to my mind would be to split out all such
probing code to separate file and then either compile it or not
depending on CONFIG_PARPORT_PC_SUPERIO.

Maciej

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

* Re: [PATCH] parport: parport_pc: PCI SIO access should also depend on SIO option
  2016-05-01 14:07     ` Maciej S. Szmigiero
@ 2016-05-01 19:46       ` Sudip Mukherjee
  0 siblings, 0 replies; 6+ messages in thread
From: Sudip Mukherjee @ 2016-05-01 19:46 UTC (permalink / raw)
  To: Maciej S. Szmigiero, Greg Kroah-Hartman; +Cc: linux-kernel, linux-parport

On Sunday 01 May 2016 03:07 PM, Maciej S. Szmigiero wrote:
> Hi Greg,
> Hi Sudip,
>
> On 01.05.2016 09:45, Sudip Mukherjee wrote:
>> On Sat, Apr 30, 2016 at 01:56:40PM -0700, Greg Kroah-Hartman wrote:
>>> On Wed, Apr 20, 2016 at 01:09:51PM +0530, Sudip Mukherjee wrote:
>>>> From: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
>>>>
>>>> CONFIG_PARPORT_PC_SUPERIO toggles Super IO chip support in parport_pc
>>>> code, however only code accessing SIO chip via ISA (or LPC) bus was
>>>> conditional on it.
>>>>
>>>> This patch makes SIO chip accesses via PCI bus also dependent on this
>>>> config option.
>>>>
>>>> It should be noted that Super IO support in parport_pc is needed only when
>>>> firmware has failed to make parallel port available either via PNP or
>>>> on standard I/O ranges and user has one of a few supported SIOs.
>>>>
>>>> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
>>>> ---
>>>>
>>>> Hi Greg,
>>>> This patch is not tested on any superio chip based hardware. (I also
>>>> don't have one).
>>>> http://www.spinics.net/lists/kernel/msg2227051.html
>>>>
>>>> I know you dislike adding #ifdef so its upto you.
>>>
>>> It's really a messy patch, surely there is a better solution.
>>
>> yes, might be. But without hardware, should i dare?

<snip>

> Other possibility that comes to my mind would be to split out all such
> probing code to separate file and then either compile it or not
> depending on CONFIG_PARPORT_PC_SUPERIO.

I thought of this one, but the lack of hardware to test is the only 
reason I am hesitating.

regards
sudip

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

* [PATCH] parport: parport_pc: PCI SIO access should also depend on SIO option
@ 2016-03-05 17:46 Maciej S. Szmigiero
  0 siblings, 0 replies; 6+ messages in thread
From: Maciej S. Szmigiero @ 2016-03-05 17:46 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: linux-kernel

CONFIG_PARPORT_PC_SUPERIO toggles Super IO chip support in parport_pc
code, however only code accessing SIO chip via ISA (or LPC) bus
was conditional on it.

This patch makes SIO chip accesses via PCI bus also dependent on
this config option.

It should be noted that Super IO support in parport_pc is needed
only when firmware has failed to make parallel port available
either via PNP or on standard I/O ranges and user has one of
a few supported SIOs.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
---
 drivers/parport/parport_pc.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 78530d1714dc..b241fb0bcde3 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2301,6 +2301,7 @@ EXPORT_SYMBOL(parport_pc_unregister_port);
 
 #ifdef CONFIG_PCI
 
+#ifdef CONFIG_PARPORT_PC_SUPERIO
 /* ITE support maintained by Rich Liu <richliu@poorman.org> */
 static int sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, int autodma,
 			      const struct parport_pc_via_data *via)
@@ -2611,6 +2612,9 @@ static struct parport_pc_superio {
 	{ sio_via_probe, &via_8231_data, },
 	{ sio_ite_8872_probe, NULL, },
 };
+#else
+#define last_sio 0
+#endif /* CONFIG_PARPORT_PC_SUPERIO */
 
 enum parport_pc_pci_cards {
 	siig_1p_10x = last_sio,
@@ -2711,11 +2715,13 @@ static struct parport_pc_pci {
 };
 
 static const struct pci_device_id parport_pc_pci_tbl[] = {
+#ifdef CONFIG_PARPORT_PC_SUPERIO
 	/* Super-IO onboard chips */
 	{ 0x1106, 0x0686, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sio_via_686a },
 	{ 0x1106, 0x8231, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sio_via_8231 },
 	{ PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8872,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, sio_ite_8872 },
+#endif
 
 	/* PCI cards */
 	{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1P_10x,
@@ -2900,7 +2906,11 @@ static struct pci_driver parport_pc_pci_driver = {
 	.probe		= parport_pc_pci_probe,
 	.remove		= parport_pc_pci_remove,
 };
+#else
+static struct pci_driver parport_pc_pci_driver;
+#endif /* CONFIG_PCI */
 
+#if defined(CONFIG_PCI) && defined(CONFIG_PARPORT_PC_SUPERIO)
 static int __init parport_pc_init_superio(int autoirq, int autodma)
 {
 	const struct pci_device_id *id;
@@ -2922,12 +2932,11 @@ static int __init parport_pc_init_superio(int autoirq, int autodma)
 	return ret; /* number of devices found */
 }
 #else
-static struct pci_driver parport_pc_pci_driver;
 static int __init parport_pc_init_superio(int autoirq, int autodma)
 {
 	return 0;
 }
-#endif /* CONFIG_PCI */
+#endif
 
 #ifdef CONFIG_PNP
 
@@ -3125,7 +3134,7 @@ static int __init parport_parse_dma(const char *dmastr, int *val)
 				     PARPORT_DMA_NONE, PARPORT_DMA_NOFIFO);
 }
 
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && defined(CONFIG_PARPORT_PC_SUPERIO)
 static int __init parport_init_mode_setup(char *str)
 {
 	printk(KERN_DEBUG
@@ -3162,7 +3171,7 @@ module_param_array(dma, charp, NULL, 0);
 MODULE_PARM_DESC(verbose_probing, "Log chit-chat during initialisation");
 module_param(verbose_probing, int, 0644);
 #endif
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && defined(CONFIG_PARPORT_PC_SUPERIO)
 static char *init_mode;
 MODULE_PARM_DESC(init_mode,
 	"Initialise mode for VIA VT8231 port (spp, ps2, epp, ecp or ecpepp)");
@@ -3174,7 +3183,7 @@ static int __init parse_parport_params(void)
 	unsigned int i;
 	int val;
 
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && defined(CONFIG_PARPORT_PC_SUPERIO)
 	if (init_mode)
 		parport_init_mode_setup(init_mode);
 #endif
@@ -3292,7 +3301,7 @@ __setup("parport=", parport_setup);
  *
  * parport_init_mode=[spp|ps2|epp|ecp|ecpepp]
  */
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && defined(CONFIG_PARPORT_PC_SUPERIO)
 __setup("parport_init_mode=", parport_init_mode_setup);
 #endif
 #endif

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

end of thread, other threads:[~2016-05-01 19:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-20  7:39 [PATCH] parport: parport_pc: PCI SIO access should also depend on SIO option Sudip Mukherjee
2016-04-30 20:56 ` Greg Kroah-Hartman
2016-05-01  7:45   ` Sudip Mukherjee
2016-05-01 14:07     ` Maciej S. Szmigiero
2016-05-01 19:46       ` Sudip Mukherjee
  -- strict thread matches above, loose matches on Subject: below --
2016-03-05 17:46 Maciej S. Szmigiero

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