diff mbox

rt2x00: make the driver build for Ralink SoC

Message ID 1363808915-14278-1-git-send-email-blogic@openwrt.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

John Crispin March 20, 2013, 7:48 p.m. UTC
Fix up the dependencies to make the driver actually compile on Ralink WiSoC.

Signed-off-by: John Crispin <blogic@openwrt.org>
---
 drivers/net/wireless/rt2x00/Kconfig     |    2 +-
 drivers/net/wireless/rt2x00/rt2x00pci.c |    2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Gertjan van Wingerde March 20, 2013, 9:29 p.m. UTC | #1
Sent from my iPad

On 20 mrt. 2013, at 20:48, John Crispin <blogic@openwrt.org> wrote:

> Fix up the dependencies to make the driver actually compile on Ralink WiSoC.
> 
> Signed-off-by: John Crispin <blogic@openwrt.org>

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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
John Crispin March 21, 2013, 7:35 a.m. UTC | #2
>> Fix up the dependencies to make the driver actually compile on Ralink WiSoC.
>>
>> Signed-off-by: John Crispin<blogic@openwrt.org>
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gabor Juhos March 21, 2013, 6:03 p.m. UTC | #3
2013.03.20. 22:29 keltezéssel, Gertjan van Wingerde írta:
> 
> 
> Sent from my iPad
> 
> On 20 mrt. 2013, at 20:48, John Crispin <blogic@openwrt.org> wrote:
> 
>> Fix up the dependencies to make the driver actually compile on Ralink WiSoC.
>>
>> Signed-off-by: John Crispin <blogic@openwrt.org>
> 
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
John W. Linville March 27, 2013, 5:17 p.m. UTC | #4
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<blogic@openwrt.org>
> >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 Crispin March 27, 2013, 6:25 p.m. UTC | #5
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<blogic@openwrt.org>
>>> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gertjan van Wingerde March 27, 2013, 8:38 p.m. UTC | #6
Sent from my iPad

On 27 mrt. 2013, at 19:25, John Crispin <blogic@openwrt.org> 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<blogic@openwrt.org>
>>>> 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


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
John Crispin March 27, 2013, 8:48 p.m. UTC | #7
>>> 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


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gabor Juhos March 29, 2013, 3:02 p.m. UTC | #8
2013.03.27. 21:38 keltezéssel, Gertjan van Wingerde írta:
> 
> 
> Sent from my iPad
> 
> On 27 mrt. 2013, at 19:25, John Crispin <blogic@openwrt.org> 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<blogic@openwrt.org>
>>>>> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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.