netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] fjes: Do not load fjes driver if system does not have extended socket device.
@ 2017-03-08 21:05 Yasuaki Ishimatsu
  2017-03-10  1:35 ` David Miller
  2017-03-12 18:29 ` Bjørn Mork
  0 siblings, 2 replies; 7+ messages in thread
From: Yasuaki Ishimatsu @ 2017-03-08 21:05 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, izumi.taku

The fjes driver is used only by FUJITSU servers and almost of all
servers in the world never use it. But currently if ACPI PNP0C02
is defined in the ACPI table, the following message is always shown:

  "FUJITSU Extended Socket Network Device Driver - version 1.2
   - Copyright (c) 2015 FUJITSU LIMITED"

The message makes users confused because there is no reason that
the message is shown in other vendor servers.

To avoid the confusion, the patch adds a check that the server
has a extended socket device or not.

Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
CC: Taku Izumi <izumi.taku@jp.fujitsu.com>
---
v2:
	- Order local variable declarations from longest to shortest line

  drivers/net/fjes/fjes_main.c | 52 +++++++++++++++++++++++++++++++++++++++-----
  1 file changed, 47 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
index b77e4ecf..a57c2cb 100644
--- a/drivers/net/fjes/fjes_main.c
+++ b/drivers/net/fjes/fjes_main.c
@@ -45,6 +45,8 @@
  MODULE_LICENSE("GPL");
  MODULE_VERSION(DRV_VERSION);

+#define ACPI_MOTHERBOARD_RESOURCE_HID "PNP0C02"
+
  static int fjes_request_irq(struct fjes_adapter *);
  static void fjes_free_irq(struct fjes_adapter *);

@@ -79,7 +81,7 @@
  static int fjes_poll(struct napi_struct *, int);

  static const struct acpi_device_id fjes_acpi_ids[] = {
-	{"PNP0C02", 0},
+	{ACPI_MOTHERBOARD_RESOURCE_HID, 0},
  	{"", 0},
  };
  MODULE_DEVICE_TABLE(acpi, fjes_acpi_ids);
@@ -116,18 +118,17 @@
  	},
  };

-static int fjes_acpi_add(struct acpi_device *device)
+static bool is_extended_socket_device(struct acpi_device *device)
  {
  	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL};
  	char str_buf[sizeof(FJES_ACPI_SYMBOL) + 1];
-	struct platform_device *plat_dev;
  	union acpi_object *str;
  	acpi_status status;
  	int result;

  	status = acpi_evaluate_object(device->handle, "_STR", NULL, &buffer);
  	if (ACPI_FAILURE(status))
-		return -ENODEV;
+		return false;

  	str = buffer.pointer;
  	result = utf16s_to_utf8s((wchar_t *)str->string.pointer,
@@ -137,10 +138,21 @@ static int fjes_acpi_add(struct acpi_device *device)

  	if (strncmp(FJES_ACPI_SYMBOL, str_buf, strlen(FJES_ACPI_SYMBOL)) != 0) {
  		kfree(buffer.pointer);
-		return -ENODEV;
+		return false;
  	}
  	kfree(buffer.pointer);

+	return true;
+}
+
+static int fjes_acpi_add(struct acpi_device *device)
+{
+	struct platform_device *plat_dev;
+	acpi_status status;
+
+	if (!is_extended_socket_device(device))
+		return -ENODEV;
+
  	status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
  				     fjes_get_acpi_resource, fjes_resource);
  	if (ACPI_FAILURE(status))
@@ -1476,11 +1488,41 @@ static void fjes_watch_unshare_task(struct work_struct *work)
  	}
  }

+static acpi_status
+acpi_find_extended_socket_device(acpi_handle obj_handle, u32 level,
+				 void *context, void **return_value)
+{
+	struct acpi_device *device;
+	bool *found = context;
+	int result;
+
+	result = acpi_bus_get_device(obj_handle, &device);
+	if (result)
+		return AE_OK;
+
+	if (strcmp(acpi_device_hid(device), ACPI_MOTHERBOARD_RESOURCE_HID))
+		return AE_OK;
+
+	if (!is_extended_socket_device(device))
+		return AE_OK;
+
+	*found = true;
+	return AE_CTRL_TERMINATE;
+}
+
  /* fjes_init_module - Driver Registration Routine */
  static int __init fjes_init_module(void)
  {
+	bool found = false;
  	int result;

+	acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+			    acpi_find_extended_socket_device, NULL, &found,
+			    NULL);
+
+	if (!found)
+		return -ENODEV;
+
  	pr_info("%s - version %s - %s\n",
  		fjes_driver_string, fjes_driver_version, fjes_copyright);

-- 
1.8.3.1

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

* Re: [PATCH v2] fjes: Do not load fjes driver if system does not have extended socket device.
  2017-03-08 21:05 [PATCH v2] fjes: Do not load fjes driver if system does not have extended socket device Yasuaki Ishimatsu
@ 2017-03-10  1:35 ` David Miller
  2017-03-10 17:09   ` Yasuaki Ishimatsu
  2017-03-12 18:29 ` Bjørn Mork
  1 sibling, 1 reply; 7+ messages in thread
From: David Miller @ 2017-03-10  1:35 UTC (permalink / raw)
  To: yasu.isimatu; +Cc: netdev, izumi.taku

From: Yasuaki Ishimatsu <yasu.isimatu@gmail.com>
Date: Wed, 8 Mar 2017 16:05:18 -0500

> The fjes driver is used only by FUJITSU servers and almost of all
> servers in the world never use it. But currently if ACPI PNP0C02
> is defined in the ACPI table, the following message is always shown:
> 
>  "FUJITSU Extended Socket Network Device Driver - version 1.2
>   - Copyright (c) 2015 FUJITSU LIMITED"
> 
> The message makes users confused because there is no reason that
> the message is shown in other vendor servers.
> 
> To avoid the confusion, the patch adds a check that the server
> has a extended socket device or not.
> 
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> CC: Taku Izumi <izumi.taku@jp.fujitsu.com>
> ---
> v2:
> 	- Order local variable declarations from longest to shortest line

This patch does not apply cleanly to the net tree.

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

* Re: [PATCH v2] fjes: Do not load fjes driver if system does not have extended socket device.
  2017-03-10  1:35 ` David Miller
@ 2017-03-10 17:09   ` Yasuaki Ishimatsu
  2017-03-13  1:02     ` Izumi, Taku
  0 siblings, 1 reply; 7+ messages in thread
From: Yasuaki Ishimatsu @ 2017-03-10 17:09 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, izumi.taku



On 03/09/2017 08:35 PM, David Miller wrote:
> From: Yasuaki Ishimatsu <yasu.isimatu@gmail.com>
> Date: Wed, 8 Mar 2017 16:05:18 -0500
>
>> The fjes driver is used only by FUJITSU servers and almost of all
>> servers in the world never use it. But currently if ACPI PNP0C02
>> is defined in the ACPI table, the following message is always shown:
>>
>>  "FUJITSU Extended Socket Network Device Driver - version 1.2
>>   - Copyright (c) 2015 FUJITSU LIMITED"
>>
>> The message makes users confused because there is no reason that
>> the message is shown in other vendor servers.
>>
>> To avoid the confusion, the patch adds a check that the server
>> has a extended socket device or not.
>>
>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>> CC: Taku Izumi <izumi.taku@jp.fujitsu.com>
>> ---
>> v2:
>> 	- Order local variable declarations from longest to shortest line
>
> This patch does not apply cleanly to the net tree.
>

Which tree did you apply the patch to?

The patch can apply to net-next tree with no conflicts as follows:

# git clone git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
Cloning into 'net-next'...
remote: Counting objects: 5265118, done.
remote: Compressing objects: 100% (805485/805485), done.
Receiving objects: 100% (5265118/5265118), 910.11 MiB | 23.42 MiB/s, done.
remote: Total 5265118 (delta 4419240), reused 5264459 (delta 4418809)
Resolving deltas: 100% (4419240/4419240), done.
Checking out files: 100% (58005/58005), done.
# head -n 30 fjes.patch
Subject: [PATCH v2] fjes: Do not load fjes driver if system does not have extended socket device.
Date: Wed, 8 Mar 2017 16:05:18 -0500
From: Yasuaki Ishimatsu <yasu.isimatu@gmail.com>
To: netdev@vger.kernel.org
CC: David Miller <davem@davemloft.net>, izumi.taku@jp.fujitsu.com

The fjes driver is used only by FUJITSU servers and almost of all
servers in the world never use it. But currently if ACPI PNP0C02
is defined in the ACPI table, the following message is always shown:

  "FUJITSU Extended Socket Network Device Driver - version 1.2
   - Copyright (c) 2015 FUJITSU LIMITED"

The message makes users confused because there is no reason that
the message is shown in other vendor servers.

To avoid the confusion, the patch adds a check that the server
has a extended socket device or not.

Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
CC: Taku Izumi <izumi.taku@jp.fujitsu.com>
---
v2:
	- Order local variable declarations from longest to shortest line

  drivers/net/fjes/fjes_main.c | 52 +++++++++++++++++++++++++++++++++++++++-----
  1 file changed, 47 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
index b77e4ecf..a57c2cb 100644
# cd net-next/
# git am ../fjes.patch
Applying: fjes: Do not load fjes driver if system does not have extended socket device.
#


Thanks,
Yasuaki Ishimatsu

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

* Re: [PATCH v2] fjes: Do not load fjes driver if system does not have extended socket device.
  2017-03-08 21:05 [PATCH v2] fjes: Do not load fjes driver if system does not have extended socket device Yasuaki Ishimatsu
  2017-03-10  1:35 ` David Miller
@ 2017-03-12 18:29 ` Bjørn Mork
  2017-03-14 14:47   ` YASUAKI ISHIMATSU
  1 sibling, 1 reply; 7+ messages in thread
From: Bjørn Mork @ 2017-03-12 18:29 UTC (permalink / raw)
  To: Yasuaki Ishimatsu; +Cc: netdev, David Miller, izumi.taku

Yasuaki Ishimatsu <yasu.isimatu@gmail.com> writes:

> The fjes driver is used only by FUJITSU servers and almost of all
> servers in the world never use it. But currently if ACPI PNP0C02
> is defined in the ACPI table, the following message is always shown:
>
>  "FUJITSU Extended Socket Network Device Driver - version 1.2
>   - Copyright (c) 2015 FUJITSU LIMITED"

Matching on PNP0C02 is fundamentally wrong. It's a way to load a device
driver on all ACPI systems.  You should not do that. I don't think it is
fair to make everyone suffer because of your inability to properly
narrow down the driver matching rules.

Could we please just delete the whole MODULE_DEVICE_TABLE() from this
driver until a proper solution is found? That way we don't need to
blacklist the driver everywhere.


Bjørn

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

* RE: [PATCH v2] fjes: Do not load fjes driver if system does not have extended socket device.
  2017-03-10 17:09   ` Yasuaki Ishimatsu
@ 2017-03-13  1:02     ` Izumi, Taku
  2017-03-14 16:07       ` YASUAKI ISHIMATSU
  0 siblings, 1 reply; 7+ messages in thread
From: Izumi, Taku @ 2017-03-13  1:02 UTC (permalink / raw)
  To: 'Yasuaki Ishimatsu'; +Cc: netdev, David Miller

Ishimatsu-san,

 Sorry for my late response.

>
> Which tree did you apply the patch to?
> 
> The patch can apply to net-next tree with no conflicts as follows:

  Not net-next but net tree:
    git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git

  I'll review and test your patch soon.

  Sincerely,
  Taku Izumi

> 
> # git clone
> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
> Cloning into 'net-next'...
> remote: Counting objects: 5265118, done.
> remote: Compressing objects: 100% (805485/805485), done.
> Receiving objects: 100% (5265118/5265118), 910.11 MiB | 23.42 MiB/s, done.
> remote: Total 5265118 (delta 4419240), reused 5264459 (delta 4418809)
> Resolving deltas: 100% (4419240/4419240), done.
> Checking out files: 100% (58005/58005), done.
> # head -n 30 fjes.patch
> Subject: [PATCH v2] fjes: Do not load fjes driver if system does not have
> extended socket device.
> Date: Wed, 8 Mar 2017 16:05:18 -0500
> From: Yasuaki Ishimatsu <yasu.isimatu@gmail.com>
> To: netdev@vger.kernel.org
> CC: David Miller <davem@davemloft.net>, izumi.taku@jp.fujitsu.com
> 
> The fjes driver is used only by FUJITSU servers and almost of all servers
> in the world never use it. But currently if ACPI PNP0C02 is defined in the
> ACPI table, the following message is always shown:
> 
>   "FUJITSU Extended Socket Network Device Driver - version 1.2
>    - Copyright (c) 2015 FUJITSU LIMITED"
> 
> The message makes users confused because there is no reason that the message
> is shown in other vendor servers.
> 
> To avoid the confusion, the patch adds a check that the server has a extended
> socket device or not.
> 
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> CC: Taku Izumi <izumi.taku@jp.fujitsu.com>
> ---
> v2:
> 	- Order local variable declarations from longest to shortest line
> 
>   drivers/net/fjes/fjes_main.c | 52
> +++++++++++++++++++++++++++++++++++++++-----
>   1 file changed, 47 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
> index b77e4ecf..a57c2cb 100644 # cd net-next/ # git am ../fjes.patch
> Applying: fjes: Do not load fjes driver if system does not have extended
> socket device.
> #
> 
> 
> Thanks,
> Yasuaki Ishimatsu

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

* Re: [PATCH v2] fjes: Do not load fjes driver if system does not have extended socket device.
  2017-03-12 18:29 ` Bjørn Mork
@ 2017-03-14 14:47   ` YASUAKI ISHIMATSU
  0 siblings, 0 replies; 7+ messages in thread
From: YASUAKI ISHIMATSU @ 2017-03-14 14:47 UTC (permalink / raw)
  To: Bjørn Mork; +Cc: netdev, David Miller, izumi.taku



On 03/12/2017 02:29 PM, Bjørn Mork wrote:
> Yasuaki Ishimatsu <yasu.isimatu@gmail.com> writes:
>
>> The fjes driver is used only by FUJITSU servers and almost of all
>> servers in the world never use it. But currently if ACPI PNP0C02
>> is defined in the ACPI table, the following message is always shown:
>>
>>  "FUJITSU Extended Socket Network Device Driver - version 1.2
>>   - Copyright (c) 2015 FUJITSU LIMITED"
>
> Matching on PNP0C02 is fundamentally wrong. It's a way to load a device
> driver on all ACPI systems.  You should not do that. I don't think it is
> fair to make everyone suffer because of your inability to properly
> narrow down the driver matching rules.

There are so many similar matching rules. But these modules are not
listed in blacklist because these modules has proper check like my patch
and no one suffers.

So I don't think the matching rule is fundamentally wrong.

Thanks,
Yasuaki Ishimatsu
>
> Could we please just delete the whole MODULE_DEVICE_TABLE() from this
> driver until a proper solution is found? That way we don't need to
> blacklist the driver everywhere.

>
>
> Bjørn
>

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

* Re: [PATCH v2] fjes: Do not load fjes driver if system does not have extended socket device.
  2017-03-13  1:02     ` Izumi, Taku
@ 2017-03-14 16:07       ` YASUAKI ISHIMATSU
  0 siblings, 0 replies; 7+ messages in thread
From: YASUAKI ISHIMATSU @ 2017-03-14 16:07 UTC (permalink / raw)
  To: Izumi, Taku; +Cc: netdev, David Miller, yasu.isimatu



On 03/12/2017 09:02 PM, Izumi, Taku wrote:
> Ishimatsu-san,
>
>  Sorry for my late response.
>
>>
>> Which tree did you apply the patch to?
>>
>> The patch can apply to net-next tree with no conflicts as follows:
>
>   Not net-next but net tree:
>     git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git

I'll update the patch soon.

Thanks,
Yasuaki Ishimatsu

>
>   I'll review and test your patch soon.
>
>   Sincerely,
>   Taku Izumi
>
>>
>> # git clone
>> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
>> Cloning into 'net-next'...
>> remote: Counting objects: 5265118, done.
>> remote: Compressing objects: 100% (805485/805485), done.
>> Receiving objects: 100% (5265118/5265118), 910.11 MiB | 23.42 MiB/s, done.
>> remote: Total 5265118 (delta 4419240), reused 5264459 (delta 4418809)
>> Resolving deltas: 100% (4419240/4419240), done.
>> Checking out files: 100% (58005/58005), done.
>> # head -n 30 fjes.patch
>> Subject: [PATCH v2] fjes: Do not load fjes driver if system does not have
>> extended socket device.
>> Date: Wed, 8 Mar 2017 16:05:18 -0500
>> From: Yasuaki Ishimatsu <yasu.isimatu@gmail.com>
>> To: netdev@vger.kernel.org
>> CC: David Miller <davem@davemloft.net>, izumi.taku@jp.fujitsu.com
>>
>> The fjes driver is used only by FUJITSU servers and almost of all servers
>> in the world never use it. But currently if ACPI PNP0C02 is defined in the
>> ACPI table, the following message is always shown:
>>
>>   "FUJITSU Extended Socket Network Device Driver - version 1.2
>>    - Copyright (c) 2015 FUJITSU LIMITED"
>>
>> The message makes users confused because there is no reason that the message
>> is shown in other vendor servers.
>>
>> To avoid the confusion, the patch adds a check that the server has a extended
>> socket device or not.
>>
>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>> CC: Taku Izumi <izumi.taku@jp.fujitsu.com>
>> ---
>> v2:
>> 	- Order local variable declarations from longest to shortest line
>>
>>   drivers/net/fjes/fjes_main.c | 52
>> +++++++++++++++++++++++++++++++++++++++-----
>>   1 file changed, 47 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
>> index b77e4ecf..a57c2cb 100644 # cd net-next/ # git am ../fjes.patch
>> Applying: fjes: Do not load fjes driver if system does not have extended
>> socket device.
>> #
>>
>>
>> Thanks,
>> Yasuaki Ishimatsu
>

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

end of thread, other threads:[~2017-03-14 16:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-08 21:05 [PATCH v2] fjes: Do not load fjes driver if system does not have extended socket device Yasuaki Ishimatsu
2017-03-10  1:35 ` David Miller
2017-03-10 17:09   ` Yasuaki Ishimatsu
2017-03-13  1:02     ` Izumi, Taku
2017-03-14 16:07       ` YASUAKI ISHIMATSU
2017-03-12 18:29 ` Bjørn Mork
2017-03-14 14:47   ` YASUAKI ISHIMATSU

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