2013-03-20 19:52:23

by John Crispin

[permalink] [raw]
Subject: [PATCH] rt2x00: make the driver build for Ralink SoC

Fix up the dependencies to make the driver actually compile on Ralink WiSoC.

Signed-off-by: John Crispin <[email protected]>
---
drivers/net/wireless/rt2x00/Kconfig | 2 +-
drivers/net/wireless/rt2x00/rt2x00pci.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig
index 2bf4efa..dc7ee6c 100644
--- a/drivers/net/wireless/rt2x00/Kconfig
+++ b/drivers/net/wireless/rt2x00/Kconfig
@@ -57,7 +57,7 @@ config RT2800PCI
tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support"
depends on PCI || SOC_RT288X || SOC_RT305X
select RT2800_LIB
- select RT2X00_LIB_PCI if PCI
+ select RT2X00_LIB_PCI
select RT2X00_LIB_SOC if SOC_RT288X || SOC_RT305X
select RT2X00_LIB_FIRMWARE
select RT2X00_LIB_CRYPTO
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index a0c8cae..fa20add 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -208,6 +208,7 @@ void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev)
}
EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize);

+#ifdef CONFIG_PCI
/*
* PCI driver handlers.
*/
@@ -392,6 +393,7 @@ int rt2x00pci_resume(struct pci_dev *pci_dev)
}
EXPORT_SYMBOL_GPL(rt2x00pci_resume);
#endif /* CONFIG_PM */
+#endif /* CONFIG_PCI */

/*
* rt2x00pci module information.
--
1.7.10.4



2013-03-20 21:29:37

by Gertjan van Wingerde

[permalink] [raw]
Subject: Re: [PATCH] rt2x00: make the driver build for Ralink SoC



Sent from my iPad

On 20 mrt. 2013, at 20:48, John Crispin <[email protected]> wrote:

> Fix up the dependencies to make the driver actually compile on Ralink WiSoC.
>
> Signed-off-by: John Crispin <[email protected]>

I don't think this is a proper way to handle this. rt2x00pci.c was only meant to be used for PCI devices; introducing the use of CONFIG_PCI in that file doesn't seem appropriate to me.

Unfortunately I am away from my home computer, so I can't look at this properly until the weekend.

> ---
> drivers/net/wireless/rt2x00/Kconfig | 2 +-
> drivers/net/wireless/rt2x00/rt2x00pci.c | 2 ++
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig
> index 2bf4efa..dc7ee6c 100644
> --- a/drivers/net/wireless/rt2x00/Kconfig
> +++ b/drivers/net/wireless/rt2x00/Kconfig
> @@ -57,7 +57,7 @@ config RT2800PCI
> tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support"
> depends on PCI || SOC_RT288X || SOC_RT305X
> select RT2800_LIB
> - select RT2X00_LIB_PCI if PCI
> + select RT2X00_LIB_PCI
> select RT2X00_LIB_SOC if SOC_RT288X || SOC_RT305X
> select RT2X00_LIB_FIRMWARE
> select RT2X00_LIB_CRYPTO
> diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
> index a0c8cae..fa20add 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
> @@ -208,6 +208,7 @@ void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev)
> }
> EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize);
>
> +#ifdef CONFIG_PCI
> /*
> * PCI driver handlers.
> */
> @@ -392,6 +393,7 @@ int rt2x00pci_resume(struct pci_dev *pci_dev)
> }
> EXPORT_SYMBOL_GPL(rt2x00pci_resume);
> #endif /* CONFIG_PM */
> +#endif /* CONFIG_PCI */
>
> /*
> * rt2x00pci module information.
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2013-03-21 18:03:05

by Gabor Juhos

[permalink] [raw]
Subject: Re: [PATCH] rt2x00: make the driver build for Ralink SoC

2013.03.20. 22:29 keltez?ssel, Gertjan van Wingerde ?rta:
>
>
> Sent from my iPad
>
> On 20 mrt. 2013, at 20:48, John Crispin <[email protected]> wrote:
>
>> Fix up the dependencies to make the driver actually compile on Ralink WiSoC.
>>
>> Signed-off-by: John Crispin <[email protected]>
>
> I don't think this is a proper way to handle this. rt2x00pci.c was only
> meant to be used for PCI devices; introducing the use of CONFIG_PCI in that file
> doesn't seem appropriate to me.

Well, CONFIG_PCI is also used in rt2800pci.c. The root cause of the problem is
that rt2800pci (despite its name) is used to drive the built-in wireless MAC of
various SoCs. This is because handling of the PCI and of the SoC built-in
devices is quite similar. However regardless of the underlying bus type,
rt2800pci uses several functions exported from rt2x00pci so it should always
select RT2X00_LIB_PCI.

The rt2x00pci_{probe,remove,suspend,resume} handlers from rt2x00pci are not used
by rt2800pci if PCI disabled. However the presence of that functions in rt2x00
causes build error if the driver is compiled with disabled PCI support.

If we properly want to fix the issue, lots of functions should be renamed and
should be moved into separate modules. The name of these new modules could be
rt2x00mmio and rt2800mmio for example.

Adding CONFIG_PCI to rt2x00pci could be a temporary solution until that is not done.

-Gabor

2013-03-29 15:02:13

by Gabor Juhos

[permalink] [raw]
Subject: Re: [PATCH] rt2x00: make the driver build for Ralink SoC

2013.03.27. 21:38 keltez?ssel, Gertjan van Wingerde ?rta:
>
>
> Sent from my iPad
>
> On 27 mrt. 2013, at 19:25, John Crispin <[email protected]> wrote:
>
>> On 27/03/13 18:17, John W. Linville wrote:
>>> On Thu, Mar 21, 2013 at 08:35:34AM +0100, John Crispin wrote:
>>>>>> Fix up the dependencies to make the driver actually compile on Ralink WiSoC.
>>>>>>
>>>>>> Signed-off-by: John Crispin<[email protected]>
>>>>> I don't think this is a proper way to handle this. rt2x00pci.c was only meant to be used for PCI devices; introducing the use of CONFIG_PCI in that file doesn't seem appropriate to me.
>>>>>
>>>>> Unfortunately I am away from my home computer, so I can't look at this properly until the weekend.
>>>>>
>>>> Indeed not the cleanest patch ... after changing the config symbols
>>>> I realized that that is not enough to make the driver actually work
>>>>
>>>> It turns out that inside openwrt the compat-wireless package sets
>>>> CONFIG_RT2800PCI=m to make the driver build and then applies the
>>>> #ifdef'ery to rt2880pci.c
>>>>
>>>> I will try to find the time today or tomorrow to have a closer look at this
>>> Any more word on this?
>> Gabor posted a series as RFC that would fix this properly ->
>>
>> http://rt2x00.serialmonkey.com/pipermail/users_rt2x00.serialmonkey.com/2013-March/005837.html
>
> Yeah, and that series looks good. Unfortunately, it is too intrusive to still apply for 3.9.
>
> John L., could we get in a scheme where we apply John C.'s patch for 3.9 and then use Gabor's series for 3.10?
> Don't know how that works with making sure that this patch is reverted for 3.10.
>
> Can you coordinate, or should I help you with this?

Sorry for the late reply. I have sent a less intrusive version of that RFC
patch-set, as an alternative solution.

-Gabor

2013-03-27 18:29:43

by John Crispin

[permalink] [raw]
Subject: Re: [PATCH] rt2x00: make the driver build for Ralink SoC

On 27/03/13 18:17, John W. Linville wrote:
> On Thu, Mar 21, 2013 at 08:35:34AM +0100, John Crispin wrote:
>>>> Fix up the dependencies to make the driver actually compile on Ralink WiSoC.
>>>>
>>>> Signed-off-by: John Crispin<[email protected]>
>>> I don't think this is a proper way to handle this. rt2x00pci.c was only meant to be used for PCI devices; introducing the use of CONFIG_PCI in that file doesn't seem appropriate to me.
>>>
>>> Unfortunately I am away from my home computer, so I can't look at this properly until the weekend.
>>>
>> Indeed not the cleanest patch ... after changing the config symbols
>> I realized that that is not enough to make the driver actually work
>>
>> It turns out that inside openwrt the compat-wireless package sets
>> CONFIG_RT2800PCI=m to make the driver build and then applies the
>> #ifdef'ery to rt2880pci.c
>>
>> I will try to find the time today or tomorrow to have a closer look at this
> Any more word on this?
Gabor posted a series as RFC that would fix this properly ->

http://rt2x00.serialmonkey.com/pipermail/users_rt2x00.serialmonkey.com/2013-March/005837.html

2013-03-21 07:39:14

by John Crispin

[permalink] [raw]
Subject: Re: [PATCH] rt2x00: make the driver build for Ralink SoC


>> Fix up the dependencies to make the driver actually compile on Ralink WiSoC.
>>
>> Signed-off-by: John Crispin<[email protected]>
> I don't think this is a proper way to handle this. rt2x00pci.c was only meant to be used for PCI devices; introducing the use of CONFIG_PCI in that file doesn't seem appropriate to me.
>
> Unfortunately I am away from my home computer, so I can't look at this properly until the weekend.
>

Indeed not the cleanest patch ... after changing the config symbols I
realized that that is not enough to make the driver actually work

It turns out that inside openwrt the compat-wireless package sets
CONFIG_RT2800PCI=m to make the driver build and then applies the
#ifdef'ery to rt2880pci.c

I will try to find the time today or tomorrow to have a closer look at this

John

2013-03-27 17:30:46

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH] rt2x00: make the driver build for Ralink SoC

On Thu, Mar 21, 2013 at 08:35:34AM +0100, John Crispin wrote:
>
> >>Fix up the dependencies to make the driver actually compile on Ralink WiSoC.
> >>
> >>Signed-off-by: John Crispin<[email protected]>
> >I don't think this is a proper way to handle this. rt2x00pci.c was only meant to be used for PCI devices; introducing the use of CONFIG_PCI in that file doesn't seem appropriate to me.
> >
> >Unfortunately I am away from my home computer, so I can't look at this properly until the weekend.
> >
>
> Indeed not the cleanest patch ... after changing the config symbols
> I realized that that is not enough to make the driver actually work
>
> It turns out that inside openwrt the compat-wireless package sets
> CONFIG_RT2800PCI=m to make the driver build and then applies the
> #ifdef'ery to rt2880pci.c
>
> I will try to find the time today or tomorrow to have a closer look at this

Any more word on this?

--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2013-03-27 20:38:59

by Gertjan van Wingerde

[permalink] [raw]
Subject: Re: [PATCH] rt2x00: make the driver build for Ralink SoC



Sent from my iPad

On 27 mrt. 2013, at 19:25, John Crispin <[email protected]> wrote:

> On 27/03/13 18:17, John W. Linville wrote:
>> On Thu, Mar 21, 2013 at 08:35:34AM +0100, John Crispin wrote:
>>>>> Fix up the dependencies to make the driver actually compile on Ralink WiSoC.
>>>>>
>>>>> Signed-off-by: John Crispin<[email protected]>
>>>> I don't think this is a proper way to handle this. rt2x00pci.c was only meant to be used for PCI devices; introducing the use of CONFIG_PCI in that file doesn't seem appropriate to me.
>>>>
>>>> Unfortunately I am away from my home computer, so I can't look at this properly until the weekend.
>>>>
>>> Indeed not the cleanest patch ... after changing the config symbols
>>> I realized that that is not enough to make the driver actually work
>>>
>>> It turns out that inside openwrt the compat-wireless package sets
>>> CONFIG_RT2800PCI=m to make the driver build and then applies the
>>> #ifdef'ery to rt2880pci.c
>>>
>>> I will try to find the time today or tomorrow to have a closer look at this
>> Any more word on this?
> Gabor posted a series as RFC that would fix this properly ->
>
> http://rt2x00.serialmonkey.com/pipermail/users_rt2x00.serialmonkey.com/2013-March/005837.html

Yeah, and that series looks good. Unfortunately, it is too intrusive to still apply for 3.9.

John L., could we get in a scheme where we apply John C.'s patch for 3.9 and then use Gabor's series for 3.10?
Don't know how that works with making sure that this patch is reverted for 3.10.

Can you coordinate, or should I help you with this?

---
Gertjan



2013-03-27 20:52:33

by John Crispin

[permalink] [raw]
Subject: Re: [PATCH] rt2x00: make the driver build for Ralink SoC


>>> Any more word on this?
>> Gabor posted a series as RFC that would fix this properly ->
>>
>> http://rt2x00.serialmonkey.com/pipermail/users_rt2x00.serialmonkey.com/2013-March/005837.html
> Yeah, and that series looks good. Unfortunately, it is too intrusive to still apply for 3.9.
>
> John L., could we get in a scheme where we apply John C.'s patch for 3.9 and then use Gabor's series for 3.10?
> Don't know how that works with making sure that this patch is reverted for 3.10.
>
> Can you coordinate, or should I help you with this?
>
Hi,

if we could apply my original 'dirty' patch as a temporary fix for 3.9,
that would be great. Its not an optimal solution but it at least makes
the code compile/work.

Gabor and myself have also accumulated a pile of other patches. In
addition to the 8 patch series that splits the pci/generic code, there
is a 20 patch series, that adds rt3662/rt3883 support, a 7 patch series
that adds rt5350 support and another 8 patches that add OF support.

I am planning to setup a git tree with all these after easter and then
send them to the list for review. Ideally these patches all make it into
3.10 as we will also be merging the remaining Ralink SoC patches via the
linux-mips tree for 3.10 (with the exception of the ethernet driver as
it will need a rewrite before I can send it upstream)

John