Code is scanning PCI bus to find out if it is switchable or not. If
CONFIG_PCI is not set, assume unswitchable.
Signed-off-by: Sinan Kaya <[email protected]>
---
drivers/platform/x86/apple-gmux.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index fd2ffebc868f..b552b54bf58b 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -742,8 +742,12 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
* If Thunderbolt is present, the external DP port is not fully
* switchable. Force its AUX channel to the discrete GPU.
*/
+#ifdef CONFIG_PCI
gmux_data->external_switchable =
!bus_for_each_dev(&pci_bus_type, NULL, NULL, is_thunderbolt);
+#else
+ gmux_data->external_switchable = false;
+#endif
if (!gmux_data->external_switchable)
gmux_write8(gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 3);
--
2.19.0
On Sat, Dec 22, 2018 at 12:14:47AM +0000, Sinan Kaya wrote:
> Code is scanning PCI bus to find out if it is switchable or not. If
> CONFIG_PCI is not set, assume unswitchable.
>
> Signed-off-by: Sinan Kaya <[email protected]>
> ---
> drivers/platform/x86/apple-gmux.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
> index fd2ffebc868f..b552b54bf58b 100644
> --- a/drivers/platform/x86/apple-gmux.c
> +++ b/drivers/platform/x86/apple-gmux.c
> @@ -742,8 +742,12 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
> * If Thunderbolt is present, the external DP port is not fully
> * switchable. Force its AUX channel to the discrete GPU.
> */
> +#ifdef CONFIG_PCI
> gmux_data->external_switchable =
> !bus_for_each_dev(&pci_bus_type, NULL, NULL, is_thunderbolt);
> +#else
> + gmux_data->external_switchable = false;
> +#endif
> if (!gmux_data->external_switchable)
> gmux_write8(gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 3);
This driver is only used on 2008+ MacBook Pros and the 2013+ Mac Pro,
all of which have PCI and are pretty much unusable with CONFIG_PCI=n.
So it is okay to just add "depends on PCI" for this driver, as you did
with other drivers, and I think that's preferrable to an #ifdef.
You can also drop the "platform/x86: " prefix from the subject if you
like, all previous commits to this driver just use "apple-gmux: ".
If you are okay with these changes, feel free to add my Reviewed-by
when respinning.
Thanks,
Lukas
On 12/22/2018 9:03 AM, Lukas Wunner wrote:
> On Sat, Dec 22, 2018 at 12:14:47AM +0000, Sinan Kaya wrote:
>> Code is scanning PCI bus to find out if it is switchable or not. If
>> CONFIG_PCI is not set, assume unswitchable.
>>
>> Signed-off-by: Sinan Kaya <[email protected]>
>> ---
>> drivers/platform/x86/apple-gmux.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
>> index fd2ffebc868f..b552b54bf58b 100644
>> --- a/drivers/platform/x86/apple-gmux.c
>> +++ b/drivers/platform/x86/apple-gmux.c
>> @@ -742,8 +742,12 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
>> * If Thunderbolt is present, the external DP port is not fully
>> * switchable. Force its AUX channel to the discrete GPU.
>> */
>> +#ifdef CONFIG_PCI
>> gmux_data->external_switchable =
>> !bus_for_each_dev(&pci_bus_type, NULL, NULL, is_thunderbolt);
>> +#else
>> + gmux_data->external_switchable = false;
>> +#endif
>> if (!gmux_data->external_switchable)
>> gmux_write8(gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 3);
>
> This driver is only used on 2008+ MacBook Pros and the 2013+ Mac Pro,
> all of which have PCI and are pretty much unusable with CONFIG_PCI=n.
>
> So it is okay to just add "depends on PCI" for this driver, as you did
> with other drivers, and I think that's preferrable to an #ifdef.
>
> You can also drop the "platform/x86: " prefix from the subject if you
> like, all previous commits to this driver just use "apple-gmux: ".
>
> If you are okay with these changes, feel free to add my Reviewed-by
> when respinning.
>
This is how I updated this patch:
commit 867d96cb6b75124b7ce11014425b8c57a8350e61 (HEAD)
Author: Sinan Kaya <[email protected]>
Date: Fri Dec 21 23:24:13 2018 +0000
apple-gmux: Make PCI dependency explicit
This driver depends on the PCI infrastructure but the dependency has not
been explicitly called out.
Signed-off-by: Sinan Kaya <[email protected]>
Reviewed-by: Lukas Wunner <[email protected]>
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index b36ea14b41ad..86b75fa55dbc 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -1136,6 +1136,7 @@ config SAMSUNG_Q10
config APPLE_GMUX
tristate "Apple Gmux Driver"
depends on ACPI
+ depends on PCI
depends on PNP
depends on BACKLIGHT_CLASS_DEVICE
depends on BACKLIGHT_APPLE=n || BACKLIGHT_APPLE
> Thanks,
>
> Lukas
>
On Mon, Dec 24, 2018 at 5:05 AM Andy Shevchenko
<[email protected]> wrote:
>
>
>
> On Saturday, December 22, 2018, Lukas Wunner <[email protected]> wrote:
>>
>> On Sat, Dec 22, 2018 at 12:14:47AM +0000, Sinan Kaya wrote:
>> > Code is scanning PCI bus to find out if it is switchable or not. If
>> > CONFIG_PCI is not set, assume unswitchable.
>> >
>>
>> You can also drop the "platform/x86: " prefix from the subject if you
>> like, all previous commits to this driver just use "apple-gmux: ".
>>
>> If you are okay with these changes, feel free to add my Reviewed-by
>> when respinning.
>>
> I'm not okay with dropping prefix. You can but may not, please, remove the prefix.
>
You mean 'keep the prefix' above, right?
What is the consensus?
>
> --
> With Best Regards,
> Andy Shevchenko
>
>