All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] fjes: Do not load fjes driver
@ 2017-03-21 15:28 YASUAKI ISHIMATSU
  2017-03-21 15:44 ` [PATCH v3 1/2] fjes: Do not load fjes driver if system does not have extended socket device YASUAKI ISHIMATSU
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: YASUAKI ISHIMATSU @ 2017-03-21 15:28 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, izumi.taku, yasu.isimatu

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 several checks.

v3:
  - Rebase on latest net tree.
  - Add _STA method check to avoid loading fjes driver.

v2:
  - Order local variable declarations from longest to shortest line

Yasuaki Ishimatsu(2):
  fjes: Do not load fjes driver if system does not have extended socket device.
  fjes: Do not load fjes driver if extended socket device is not power on.

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

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

* [PATCH v3 1/2] fjes: Do not load fjes driver if system does not have extended socket device.
  2017-03-21 15:28 [PATCH v3 0/2] fjes: Do not load fjes driver YASUAKI ISHIMATSU
@ 2017-03-21 15:44 ` YASUAKI ISHIMATSU
  2017-03-21 15:46 ` [PATCH v3 2/2] fjes: Do not load fjes driver if extended socket device is not power on YASUAKI ISHIMATSU
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: YASUAKI ISHIMATSU @ 2017-03-21 15:44 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>
---
v3:
	- Rebase on net tree

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 c4b3c4b..7b58964 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 *);

@@ -78,7 +80,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);
@@ -115,18 +117,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,
@@ -136,10 +137,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))
@@ -1473,11 +1485,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



On 03/21/2017 11:28 AM, YASUAKI ISHIMATSU wrote:
> 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 several checks.
> 
> v3:
>   - Rebase on latest net tree.
>   - Add _STA method check to avoid loading fjes driver.
> 
> v2:
>   - Order local variable declarations from longest to shortest line
> 
> Yasuaki Ishimatsu(2):
>   fjes: Do not load fjes driver if system does not have extended socket device.
>   fjes: Do not load fjes driver if extended socket device is not power on.
> 
>  drivers/net/fjes/fjes_main.c | 76 +++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 71 insertions(+), 5 deletions(-)
> 

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

* [PATCH v3 2/2] fjes: Do not load fjes driver if extended socket device is not power on.
  2017-03-21 15:28 [PATCH v3 0/2] fjes: Do not load fjes driver YASUAKI ISHIMATSU
  2017-03-21 15:44 ` [PATCH v3 1/2] fjes: Do not load fjes driver if system does not have extended socket device YASUAKI ISHIMATSU
@ 2017-03-21 15:46 ` YASUAKI ISHIMATSU
  2017-03-22 19:39 ` [PATCH v3 0/2] fjes: Do not load fjes driver David Miller
  2017-03-23  0:02 ` Izumi, Taku
  3 siblings, 0 replies; 5+ messages in thread
From: YASUAKI ISHIMATSU @ 2017-03-21 15:46 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, izumi.taku

The extended device socket cannot turn on/off while system is running.
So when system boots up and the device is not power on, the fjes driver
does not need be loaded.

To check the status of the device, the patch adds ACPI _STA method check.

Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
CC: Taku Izumi <izumi.taku@jp.fujitsu.com>
---
 drivers/net/fjes/fjes_main.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
index 7b58964..ae48c80 100644
--- a/drivers/net/fjes/fjes_main.c
+++ b/drivers/net/fjes/fjes_main.c
@@ -144,6 +144,24 @@ static bool is_extended_socket_device(struct acpi_device *device)
 	return true;
 }

+static int acpi_check_extended_socket_status(struct acpi_device *device)
+{
+	unsigned long long sta;
+	acpi_status status;
+
+	status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
+	if (ACPI_FAILURE(status))
+		return -ENODEV;
+
+	if (!((sta & ACPI_STA_DEVICE_PRESENT) &&
+	      (sta & ACPI_STA_DEVICE_ENABLED) &&
+	      (sta & ACPI_STA_DEVICE_UI) &&
+	      (sta & ACPI_STA_DEVICE_FUNCTIONING)))
+		return -ENODEV;
+
+	return 0;
+}
+
 static int fjes_acpi_add(struct acpi_device *device)
 {
 	struct platform_device *plat_dev;
@@ -152,6 +170,9 @@ static int fjes_acpi_add(struct acpi_device *device)
 	if (!is_extended_socket_device(device))
 		return -ENODEV;

+	if (acpi_check_extended_socket_status(device))
+		return -ENODEV;
+
 	status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
 				     fjes_get_acpi_resource, fjes_resource);
 	if (ACPI_FAILURE(status))
@@ -1503,6 +1524,9 @@ static void fjes_watch_unshare_task(struct work_struct *work)
 	if (!is_extended_socket_device(device))
 		return AE_OK;

+	if (acpi_check_extended_socket_status(device))
+		return AE_OK;
+
 	*found = true;
 	return AE_CTRL_TERMINATE;
 }
-- 
1.8.3.1


On 03/21/2017 11:28 AM, YASUAKI ISHIMATSU wrote:
> 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 several checks.
> 
> v3:
>   - Rebase on latest net tree.
>   - Add _STA method check to avoid loading fjes driver.
> 
> v2:
>   - Order local variable declarations from longest to shortest line
> 
> Yasuaki Ishimatsu(2):
>   fjes: Do not load fjes driver if system does not have extended socket device.
>   fjes: Do not load fjes driver if extended socket device is not power on.
> 
>  drivers/net/fjes/fjes_main.c | 76 +++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 71 insertions(+), 5 deletions(-)
> 

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

* Re: [PATCH v3 0/2] fjes: Do not load fjes driver
  2017-03-21 15:28 [PATCH v3 0/2] fjes: Do not load fjes driver YASUAKI ISHIMATSU
  2017-03-21 15:44 ` [PATCH v3 1/2] fjes: Do not load fjes driver if system does not have extended socket device YASUAKI ISHIMATSU
  2017-03-21 15:46 ` [PATCH v3 2/2] fjes: Do not load fjes driver if extended socket device is not power on YASUAKI ISHIMATSU
@ 2017-03-22 19:39 ` David Miller
  2017-03-23  0:02 ` Izumi, Taku
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-03-22 19:39 UTC (permalink / raw)
  To: yasu.isimatu; +Cc: netdev, izumi.taku

From: YASUAKI ISHIMATSU <yasu.isimatu@gmail.com>
Date: Tue, 21 Mar 2017 11:28:02 -0400

> 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 several checks.
> 
> v3:
>   - Rebase on latest net tree.
>   - Add _STA method check to avoid loading fjes driver.
> 
> v2:
>   - Order local variable declarations from longest to shortest line

Series applied, thanks.

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

* RE: [PATCH v3 0/2] fjes: Do not load fjes driver
  2017-03-21 15:28 [PATCH v3 0/2] fjes: Do not load fjes driver YASUAKI ISHIMATSU
                   ` (2 preceding siblings ...)
  2017-03-22 19:39 ` [PATCH v3 0/2] fjes: Do not load fjes driver David Miller
@ 2017-03-23  0:02 ` Izumi, Taku
  3 siblings, 0 replies; 5+ messages in thread
From: Izumi, Taku @ 2017-03-23  0:02 UTC (permalink / raw)
  To: 'YASUAKI ISHIMATSU', netdev; +Cc: David Miller

Tested-by: Taku Izumi <izumi.taku@jp.fujitsu.com>

> -----Original Message-----
> From: YASUAKI ISHIMATSU [mailto:yasu.isimatu@gmail.com]
> Sent: Wednesday, March 22, 2017 12:28 AM
> To: netdev@vger.kernel.org
> Cc: David Miller <davem@davemloft.net>; Izumi, Taku/泉 拓
> <izumi.taku@jp.fujitsu.com>; yasu.isimatu@gmail.com
> Subject: [PATCH v3 0/2] fjes: Do not load fjes driver
> 
> 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 several checks.
> 
> v3:
>   - Rebase on latest net tree.
>   - Add _STA method check to avoid loading fjes driver.
> 
> v2:
>   - Order local variable declarations from longest to shortest line
> 
> Yasuaki Ishimatsu(2):
>   fjes: Do not load fjes driver if system does not have extended socket
> device.
>   fjes: Do not load fjes driver if extended socket device is not power on.
> 
>  drivers/net/fjes/fjes_main.c | 76
> +++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 71 insertions(+), 5 deletions(-)


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

end of thread, other threads:[~2017-03-23  0:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 15:28 [PATCH v3 0/2] fjes: Do not load fjes driver YASUAKI ISHIMATSU
2017-03-21 15:44 ` [PATCH v3 1/2] fjes: Do not load fjes driver if system does not have extended socket device YASUAKI ISHIMATSU
2017-03-21 15:46 ` [PATCH v3 2/2] fjes: Do not load fjes driver if extended socket device is not power on YASUAKI ISHIMATSU
2017-03-22 19:39 ` [PATCH v3 0/2] fjes: Do not load fjes driver David Miller
2017-03-23  0:02 ` Izumi, Taku

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.