linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/5] serdev: Split and export serdev_acpi_get_uart_resource()
@ 2021-08-03 19:29 Andy Shevchenko
  2021-08-03 19:29 ` [PATCH v1 2/5] platform/surface: aggregator: Use serdev_acpi_get_uart_resource() helper Andy Shevchenko
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-08-03 19:29 UTC (permalink / raw)
  To: Andy Shevchenko, Hans de Goede, Maximilian Luz, Lee Jones,
	Greg Kroah-Hartman, linux-bluetooth, linux-kernel,
	platform-driver-x86, linux-serial
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Mark Gross, Rob Herring, Jiri Slaby

The same as for I²C Serial Bus resource split and export
serdev_acpi_get_uart_resource(). We have already 3 users
one of which is converted here.

Rationale of this is to consolidate parsing UART Serial Bus
resource in one place as it's done, e.g., for I²C Serial Bus.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/tty/serdev/core.c | 36 +++++++++++++++++++++++++++++-------
 include/linux/serdev.h    | 14 ++++++++++++++
 2 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index 92498961fd92..436e3d1ba92c 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -562,23 +562,45 @@ struct acpi_serdev_lookup {
 	int index;
 };
 
+/**
+ * serdev_acpi_get_uart_resource - Gets UARTSerialBus resource if type matches
+ * @ares:	ACPI resource
+ * @uart:	Pointer to UARTSerialBus resource will be returned here
+ *
+ * Checks if the given ACPI resource is of type UARTSerialBus.
+ * In this case, returns a pointer to it to the caller.
+ *
+ * Returns true if resource type is of UARTSerialBus, otherwise false.
+ */
+bool serdev_acpi_get_uart_resource(struct acpi_resource *ares,
+				   struct acpi_resource_uart_serialbus **uart)
+{
+	struct acpi_resource_uart_serialbus *sb;
+
+	if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
+		return false;
+
+	sb = &ares->data.uart_serial_bus;
+	if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_UART)
+		return false;
+
+	*uart = sb;
+	return true;
+}
+EXPORT_SYMBOL_GPL(serdev_acpi_get_uart_resource);
+
 static int acpi_serdev_parse_resource(struct acpi_resource *ares, void *data)
 {
 	struct acpi_serdev_lookup *lookup = data;
 	struct acpi_resource_uart_serialbus *sb;
 	acpi_status status;
 
-	if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
-		return 1;
-
-	if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
+	if (!serdev_acpi_get_uart_resource(ares, &sb))
 		return 1;
 
 	if (lookup->index != -1 && lookup->n++ != lookup->index)
 		return 1;
 
-	sb = &ares->data.uart_serial_bus;
-
 	status = acpi_get_handle(lookup->device_handle,
 				 sb->resource_source.string_ptr,
 				 &lookup->controller_handle);
@@ -586,7 +608,7 @@ static int acpi_serdev_parse_resource(struct acpi_resource *ares, void *data)
 		return 1;
 
 	/*
-	 * NOTE: Ideally, we would also want to retreive other properties here,
+	 * NOTE: Ideally, we would also want to retrieve other properties here,
 	 * once setting them before opening the device is supported by serdev.
 	 */
 
diff --git a/include/linux/serdev.h b/include/linux/serdev.h
index 9f14f9c12ec4..3368c261ab62 100644
--- a/include/linux/serdev.h
+++ b/include/linux/serdev.h
@@ -327,4 +327,18 @@ static inline int serdev_tty_port_unregister(struct tty_port *port)
 }
 #endif /* CONFIG_SERIAL_DEV_CTRL_TTYPORT */
 
+struct acpi_resource;
+struct acpi_resource_uart_serialbus;
+
+#ifdef CONFIG_ACPI
+bool serdev_acpi_get_uart_resource(struct acpi_resource *ares,
+				   struct acpi_resource_uart_serialbus **uart);
+#else
+static inline bool serdev_acpi_get_uart_resource(struct acpi_resource *ares,
+						 struct acpi_resource_uart_serialbus **uart)
+{
+	return false;
+}
+#endif /* CONFIG_ACPI */
+
 #endif /*_LINUX_SERDEV_H */
-- 
2.30.2


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

* [PATCH v1 2/5] platform/surface: aggregator: Use serdev_acpi_get_uart_resource() helper
  2021-08-03 19:29 [PATCH v1 1/5] serdev: Split and export serdev_acpi_get_uart_resource() Andy Shevchenko
@ 2021-08-03 19:29 ` Andy Shevchenko
  2021-08-03 19:47   ` Maximilian Luz
  2021-08-03 19:29 ` [PATCH v1 3/5] Bluetooth: hci_bcm: " Andy Shevchenko
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2021-08-03 19:29 UTC (permalink / raw)
  To: Andy Shevchenko, Hans de Goede, Maximilian Luz, Lee Jones,
	Greg Kroah-Hartman, linux-bluetooth, linux-kernel,
	platform-driver-x86, linux-serial
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Mark Gross, Rob Herring, Jiri Slaby

serdev provides a generic helper to get UART Serial Bus resources.
Use it instead of open coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/surface/aggregator/core.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/platform/surface/aggregator/core.c b/drivers/platform/surface/aggregator/core.c
index 279d9df19c01..c61bbeeec2df 100644
--- a/drivers/platform/surface/aggregator/core.c
+++ b/drivers/platform/surface/aggregator/core.c
@@ -301,20 +301,13 @@ static acpi_status ssam_serdev_setup_via_acpi_crs(struct acpi_resource *rsc,
 						  void *ctx)
 {
 	struct serdev_device *serdev = ctx;
-	struct acpi_resource_common_serialbus *serial;
 	struct acpi_resource_uart_serialbus *uart;
 	bool flow_control;
 	int status = 0;
 
-	if (rsc->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
+	if (!serdev_acpi_get_uart_resource(rsc, &uart))
 		return AE_OK;
 
-	serial = &rsc->data.common_serial_bus;
-	if (serial->type != ACPI_RESOURCE_SERIAL_TYPE_UART)
-		return AE_OK;
-
-	uart = &rsc->data.uart_serial_bus;
-
 	/* Set up serdev device. */
 	serdev_device_set_baudrate(serdev, uart->default_baud_rate);
 
-- 
2.30.2


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

* [PATCH v1 3/5] Bluetooth: hci_bcm: Use serdev_acpi_get_uart_resource() helper
  2021-08-03 19:29 [PATCH v1 1/5] serdev: Split and export serdev_acpi_get_uart_resource() Andy Shevchenko
  2021-08-03 19:29 ` [PATCH v1 2/5] platform/surface: aggregator: Use serdev_acpi_get_uart_resource() helper Andy Shevchenko
@ 2021-08-03 19:29 ` Andy Shevchenko
  2021-08-04  8:12   ` Hans de Goede
  2021-08-03 19:29 ` [PATCH v1 4/5] Bluetooth: hci_bcm: Use acpi_gpio_get_*_resource() helpers Andy Shevchenko
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2021-08-03 19:29 UTC (permalink / raw)
  To: Andy Shevchenko, Hans de Goede, Maximilian Luz, Lee Jones,
	Greg Kroah-Hartman, linux-bluetooth, linux-kernel,
	platform-driver-x86, linux-serial
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Mark Gross, Rob Herring, Jiri Slaby

serdev provides a generic helper to get UART Serial Bus resources.
Use it instead of open coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/bluetooth/hci_bcm.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index 3cd57fc56ade..16f854ac19b6 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -899,9 +899,9 @@ static const struct acpi_gpio_mapping acpi_bcm_int_first_gpios[] = {
 static int bcm_resource(struct acpi_resource *ares, void *data)
 {
 	struct bcm_device *dev = data;
+	struct acpi_resource_uart_serialbus *uart;
 	struct acpi_resource_extended_irq *irq;
 	struct acpi_resource_gpio *gpio;
-	struct acpi_resource_uart_serialbus *sb;
 
 	switch (ares->type) {
 	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
@@ -920,18 +920,15 @@ static int bcm_resource(struct acpi_resource *ares, void *data)
 		dev->gpio_count++;
 		break;
 
-	case ACPI_RESOURCE_TYPE_SERIAL_BUS:
-		sb = &ares->data.uart_serial_bus;
-		if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_UART) {
-			dev->init_speed = sb->default_baud_rate;
-			dev->oper_speed = 4000000;
-		}
-		break;
-
 	default:
 		break;
 	}
 
+	if (serdev_acpi_get_uart_resource(ares, &uart)) {
+		dev->init_speed = uart->default_baud_rate;
+		dev->oper_speed = 4000000;
+	}
+
 	return 0;
 }
 
-- 
2.30.2


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

* [PATCH v1 4/5] Bluetooth: hci_bcm: Use acpi_gpio_get_*_resource() helpers
  2021-08-03 19:29 [PATCH v1 1/5] serdev: Split and export serdev_acpi_get_uart_resource() Andy Shevchenko
  2021-08-03 19:29 ` [PATCH v1 2/5] platform/surface: aggregator: Use serdev_acpi_get_uart_resource() helper Andy Shevchenko
  2021-08-03 19:29 ` [PATCH v1 3/5] Bluetooth: hci_bcm: " Andy Shevchenko
@ 2021-08-03 19:29 ` Andy Shevchenko
  2021-08-04  8:04   ` Hans de Goede
  2021-08-03 19:29 ` [PATCH v1 5/5] Bluetooth: hci_bcm: Fix kernel doc comments Andy Shevchenko
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2021-08-03 19:29 UTC (permalink / raw)
  To: Andy Shevchenko, Hans de Goede, Maximilian Luz, Lee Jones,
	Greg Kroah-Hartman, linux-bluetooth, linux-kernel,
	platform-driver-x86, linux-serial
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Mark Gross, Rob Herring, Jiri Slaby

ACPI provides generic helpers to get GPIO interrupt and IO resources.
Use it instead of open coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/bluetooth/hci_bcm.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index 16f854ac19b6..ed99fcde2523 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -911,15 +911,6 @@ static int bcm_resource(struct acpi_resource *ares, void *data)
 		dev->irq_active_low = true;
 		break;
 
-	case ACPI_RESOURCE_TYPE_GPIO:
-		gpio = &ares->data.gpio;
-		if (gpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT) {
-			dev->gpio_int_idx = dev->gpio_count;
-			dev->irq_active_low = gpio->polarity == ACPI_ACTIVE_LOW;
-		}
-		dev->gpio_count++;
-		break;
-
 	default:
 		break;
 	}
@@ -927,6 +918,12 @@ static int bcm_resource(struct acpi_resource *ares, void *data)
 	if (serdev_acpi_get_uart_resource(ares, &uart)) {
 		dev->init_speed = uart->default_baud_rate;
 		dev->oper_speed = 4000000;
+	} else if (acpi_gpio_get_irq_resource(ares, &gpio)) {
+		dev->gpio_int_idx = dev->gpio_count;
+		dev->irq_active_low = gpio->polarity == ACPI_ACTIVE_LOW;
+		dev->gpio_count++;
+	} else if (acpi_gpio_get_io_resource(ares, &gpio)) {
+		dev->gpio_count++;
 	}
 
 	return 0;
-- 
2.30.2


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

* [PATCH v1 5/5] Bluetooth: hci_bcm: Fix kernel doc comments
  2021-08-03 19:29 [PATCH v1 1/5] serdev: Split and export serdev_acpi_get_uart_resource() Andy Shevchenko
                   ` (2 preceding siblings ...)
  2021-08-03 19:29 ` [PATCH v1 4/5] Bluetooth: hci_bcm: Use acpi_gpio_get_*_resource() helpers Andy Shevchenko
@ 2021-08-03 19:29 ` Andy Shevchenko
  2021-08-03 20:04 ` [v1,1/5] serdev: Split and export serdev_acpi_get_uart_resource() bluez.test.bot
  2021-08-04  8:08 ` [PATCH v1 1/5] " Hans de Goede
  5 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-08-03 19:29 UTC (permalink / raw)
  To: Andy Shevchenko, Hans de Goede, Maximilian Luz, Lee Jones,
	Greg Kroah-Hartman, linux-bluetooth, linux-kernel,
	platform-driver-x86, linux-serial
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Mark Gross, Rob Herring, Jiri Slaby

Kernel doc validator complains about few missed parameter descriptions.
Fill the gap by describing them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/bluetooth/hci_bcm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index ed99fcde2523..fd0acadb9102 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -51,6 +51,7 @@
 /**
  * struct bcm_device_data - device specific data
  * @no_early_set_baudrate: Disallow set baudrate before driver setup()
+ * @drive_rts_on_open: drive RTS signal on ->open() when platform requires it
  */
 struct bcm_device_data {
 	bool	no_early_set_baudrate;
@@ -77,6 +78,8 @@ struct bcm_device_data {
  * @btlp: Apple ACPI method to toggle BT_WAKE pin ("Bluetooth Low Power")
  * @btpu: Apple ACPI method to drive BT_REG_ON pin high ("Bluetooth Power Up")
  * @btpd: Apple ACPI method to drive BT_REG_ON pin low ("Bluetooth Power Down")
+ * @gpio_count: internal counter for GPIO resources associated with ACPI device
+ * @gpio_int_idx: index in _CRS for GpioInt() resource
  * @txco_clk: external reference frequency clock used by Bluetooth device
  * @lpo_clk: external LPO clock used by Bluetooth device
  * @supplies: VBAT and VDDIO supplies used by Bluetooth device
@@ -88,10 +91,13 @@ struct bcm_device_data {
  *	set to 0 if @init_speed is already the preferred baudrate
  * @irq: interrupt triggered by HOST_WAKE_BT pin
  * @irq_active_low: whether @irq is active low
+ * @irq_acquired: flag to show if IRQ handler has been assigned
  * @hu: pointer to HCI UART controller struct,
  *	used to disable flow control during runtime suspend and system sleep
  * @is_suspended: whether flow control is currently disabled
  * @no_early_set_baudrate: don't set_baudrate before setup()
+ * @drive_rts_on_open: drive RTS signal on ->open() when platform requires it
+ * @pcm_int_params: keep the initial PCM configuration
  */
 struct bcm_device {
 	/* Must be the first member, hci_serdev.c expects this. */
-- 
2.30.2


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

* Re: [PATCH v1 2/5] platform/surface: aggregator: Use serdev_acpi_get_uart_resource() helper
  2021-08-03 19:29 ` [PATCH v1 2/5] platform/surface: aggregator: Use serdev_acpi_get_uart_resource() helper Andy Shevchenko
@ 2021-08-03 19:47   ` Maximilian Luz
  0 siblings, 0 replies; 14+ messages in thread
From: Maximilian Luz @ 2021-08-03 19:47 UTC (permalink / raw)
  To: Andy Shevchenko, Hans de Goede, Lee Jones, Greg Kroah-Hartman,
	linux-bluetooth, linux-kernel, platform-driver-x86, linux-serial
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Mark Gross, Rob Herring, Jiri Slaby

On 8/3/21 9:29 PM, Andy Shevchenko wrote:
> serdev provides a generic helper to get UART Serial Bus resources.
> Use it instead of open coded variant.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks! Looks good to me.

Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>

> ---
>   drivers/platform/surface/aggregator/core.c | 9 +--------
>   1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/platform/surface/aggregator/core.c b/drivers/platform/surface/aggregator/core.c
> index 279d9df19c01..c61bbeeec2df 100644
> --- a/drivers/platform/surface/aggregator/core.c
> +++ b/drivers/platform/surface/aggregator/core.c
> @@ -301,20 +301,13 @@ static acpi_status ssam_serdev_setup_via_acpi_crs(struct acpi_resource *rsc,
>   						  void *ctx)
>   {
>   	struct serdev_device *serdev = ctx;
> -	struct acpi_resource_common_serialbus *serial;
>   	struct acpi_resource_uart_serialbus *uart;
>   	bool flow_control;
>   	int status = 0;
>   
> -	if (rsc->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
> +	if (!serdev_acpi_get_uart_resource(rsc, &uart))
>   		return AE_OK;
>   
> -	serial = &rsc->data.common_serial_bus;
> -	if (serial->type != ACPI_RESOURCE_SERIAL_TYPE_UART)
> -		return AE_OK;
> -
> -	uart = &rsc->data.uart_serial_bus;
> -
>   	/* Set up serdev device. */
>   	serdev_device_set_baudrate(serdev, uart->default_baud_rate);
>   
> 

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

* RE: [v1,1/5] serdev: Split and export serdev_acpi_get_uart_resource()
  2021-08-03 19:29 [PATCH v1 1/5] serdev: Split and export serdev_acpi_get_uart_resource() Andy Shevchenko
                   ` (3 preceding siblings ...)
  2021-08-03 19:29 ` [PATCH v1 5/5] Bluetooth: hci_bcm: Fix kernel doc comments Andy Shevchenko
@ 2021-08-03 20:04 ` bluez.test.bot
  2021-08-03 20:32   ` Andy Shevchenko
  2021-08-04  8:08 ` [PATCH v1 1/5] " Hans de Goede
  5 siblings, 1 reply; 14+ messages in thread
From: bluez.test.bot @ 2021-08-03 20:04 UTC (permalink / raw)
  To: linux-bluetooth, andriy.shevchenko

[-- Attachment #1: Type: text/plain, Size: 2727 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=525847

---Test result---

Test Summary:
CheckPatch                    PASS      1.93 seconds
GitLint                       PASS      0.50 seconds
BuildKernel                   PASS      521.78 seconds
TestRunner: Setup             PASS      344.58 seconds
TestRunner: l2cap-tester      PASS      2.59 seconds
TestRunner: bnep-tester       PASS      1.93 seconds
TestRunner: mgmt-tester       PASS      31.06 seconds
TestRunner: rfcomm-tester     PASS      2.10 seconds
TestRunner: sco-tester        PASS      2.04 seconds
TestRunner: smp-tester        FAIL      2.09 seconds
TestRunner: userchan-tester   PASS      1.95 seconds

Details
##############################
Test: CheckPatch - PASS - 1.93 seconds
Run checkpatch.pl script with rule in .checkpatch.conf


##############################
Test: GitLint - PASS - 0.50 seconds
Run gitlint with rule in .gitlint


##############################
Test: BuildKernel - PASS - 521.78 seconds
Build Kernel with minimal configuration supports Bluetooth


##############################
Test: TestRunner: Setup - PASS - 344.58 seconds
Setup environment for running Test Runner


##############################
Test: TestRunner: l2cap-tester - PASS - 2.59 seconds
Run test-runner with l2cap-tester
Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: bnep-tester - PASS - 1.93 seconds
Run test-runner with bnep-tester
Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: mgmt-tester - PASS - 31.06 seconds
Run test-runner with mgmt-tester
Total: 448, Passed: 445 (99.3%), Failed: 0, Not Run: 3

##############################
Test: TestRunner: rfcomm-tester - PASS - 2.10 seconds
Run test-runner with rfcomm-tester
Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: sco-tester - PASS - 2.04 seconds
Run test-runner with sco-tester
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: smp-tester - FAIL - 2.09 seconds
Run test-runner with smp-tester
Total: 8, Passed: 7 (87.5%), Failed: 1, Not Run: 0

Failed Test Cases
SMP Client - SC Request 2                            Failed       0.022 seconds

##############################
Test: TestRunner: userchan-tester - PASS - 1.95 seconds
Run test-runner with userchan-tester
Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0



---
Regards,
Linux Bluetooth


[-- Attachment #2: l2cap-tester.log --]
[-- Type: application/octet-stream, Size: 44385 bytes --]

[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3592 bytes --]

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 616858 bytes --]

[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 11712 bytes --]

[-- Attachment #6: sco-tester.log --]
[-- Type: application/octet-stream, Size: 9947 bytes --]

[-- Attachment #7: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11740 bytes --]

[-- Attachment #8: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 5489 bytes --]

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

* Re: [v1,1/5] serdev: Split and export serdev_acpi_get_uart_resource()
  2021-08-03 20:04 ` [v1,1/5] serdev: Split and export serdev_acpi_get_uart_resource() bluez.test.bot
@ 2021-08-03 20:32   ` Andy Shevchenko
  0 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-08-03 20:32 UTC (permalink / raw)
  To: linux-bluetooth

On Tue, Aug 03, 2021 at 01:04:18PM -0700, bluez.test.bot@gmail.com wrote:
> This is automated email and please do not reply to this email!
> 
> Dear submitter,
> 
> Thank you for submitting the patches to the linux bluetooth mailing list.
> This is a CI test results with your patch series:
> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=525847

...

> ##############################
> Test: TestRunner: smp-tester - FAIL - 2.09 seconds
> Run test-runner with smp-tester
> Total: 8, Passed: 7 (87.5%), Failed: 1, Not Run: 0
> 
> Failed Test Cases
> SMP Client - SC Request 2                            Failed       0.022 seconds
> 
> ##############################
> Test: TestRunner: userchan-tester - PASS - 1.95 seconds
> Run test-runner with userchan-tester
> Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0

Hmm... I have read logs and I have no clue how my series may affect this. Any
BT expert here to shed a light?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 4/5] Bluetooth: hci_bcm: Use acpi_gpio_get_*_resource() helpers
  2021-08-03 19:29 ` [PATCH v1 4/5] Bluetooth: hci_bcm: Use acpi_gpio_get_*_resource() helpers Andy Shevchenko
@ 2021-08-04  8:04   ` Hans de Goede
  0 siblings, 0 replies; 14+ messages in thread
From: Hans de Goede @ 2021-08-04  8:04 UTC (permalink / raw)
  To: Andy Shevchenko, Maximilian Luz, Lee Jones, Greg Kroah-Hartman,
	linux-bluetooth, linux-kernel, platform-driver-x86, linux-serial
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Mark Gross, Rob Herring, Jiri Slaby

Hi,

On 8/3/21 9:29 PM, Andy Shevchenko wrote:
> ACPI provides generic helpers to get GPIO interrupt and IO resources.
> Use it instead of open coded variant.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

As explained in my reply to 3/5 this makes the code a lot harder
to read with little to no gain, so NACK from me for this one.

Regards,

Hans

> ---
>  drivers/bluetooth/hci_bcm.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
> index 16f854ac19b6..ed99fcde2523 100644
> --- a/drivers/bluetooth/hci_bcm.c
> +++ b/drivers/bluetooth/hci_bcm.c
> @@ -911,15 +911,6 @@ static int bcm_resource(struct acpi_resource *ares, void *data)
>  		dev->irq_active_low = true;
>  		break;
>  
> -	case ACPI_RESOURCE_TYPE_GPIO:
> -		gpio = &ares->data.gpio;
> -		if (gpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT) {
> -			dev->gpio_int_idx = dev->gpio_count;
> -			dev->irq_active_low = gpio->polarity == ACPI_ACTIVE_LOW;
> -		}
> -		dev->gpio_count++;
> -		break;
> -
>  	default:
>  		break;
>  	}
> @@ -927,6 +918,12 @@ static int bcm_resource(struct acpi_resource *ares, void *data)
>  	if (serdev_acpi_get_uart_resource(ares, &uart)) {
>  		dev->init_speed = uart->default_baud_rate;
>  		dev->oper_speed = 4000000;
> +	} else if (acpi_gpio_get_irq_resource(ares, &gpio)) {
> +		dev->gpio_int_idx = dev->gpio_count;
> +		dev->irq_active_low = gpio->polarity == ACPI_ACTIVE_LOW;
> +		dev->gpio_count++;
> +	} else if (acpi_gpio_get_io_resource(ares, &gpio)) {
> +		dev->gpio_count++;
>  	}
>  
>  	return 0;
> 


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

* Re: [PATCH v1 1/5] serdev: Split and export serdev_acpi_get_uart_resource()
  2021-08-03 19:29 [PATCH v1 1/5] serdev: Split and export serdev_acpi_get_uart_resource() Andy Shevchenko
                   ` (4 preceding siblings ...)
  2021-08-03 20:04 ` [v1,1/5] serdev: Split and export serdev_acpi_get_uart_resource() bluez.test.bot
@ 2021-08-04  8:08 ` Hans de Goede
  2021-08-04 12:07   ` Andy Shevchenko
  5 siblings, 1 reply; 14+ messages in thread
From: Hans de Goede @ 2021-08-04  8:08 UTC (permalink / raw)
  To: Andy Shevchenko, Maximilian Luz, Lee Jones, Greg Kroah-Hartman,
	linux-bluetooth, linux-kernel, platform-driver-x86, linux-serial
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Mark Gross, Rob Herring, Jiri Slaby

Hi,

On 8/3/21 9:29 PM, Andy Shevchenko wrote:
> The same as for I²C Serial Bus resource split and export
> serdev_acpi_get_uart_resource(). We have already 3 users
> one of which is converted here.
> 
> Rationale of this is to consolidate parsing UART Serial Bus
> resource in one place as it's done, e.g., for I²C Serial Bus.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

*for this patch*

We do need to talk about how to merge this series, I've
NACK-ed patches 3/5 and 4/5 (see my reply there) so that
leaves just 2/5  as depending on this one. I believe it
would be easiest to just merge 1/5 + 2/5 to the tree
which caries serdev patches, which I guess is Greg's
tty tree ?

Greg can you pick up 1/5 and 2/5 ?

Regards,

Hans



> ---
>  drivers/tty/serdev/core.c | 36 +++++++++++++++++++++++++++++-------
>  include/linux/serdev.h    | 14 ++++++++++++++
>  2 files changed, 43 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> index 92498961fd92..436e3d1ba92c 100644
> --- a/drivers/tty/serdev/core.c
> +++ b/drivers/tty/serdev/core.c
> @@ -562,23 +562,45 @@ struct acpi_serdev_lookup {
>  	int index;
>  };
>  
> +/**
> + * serdev_acpi_get_uart_resource - Gets UARTSerialBus resource if type matches
> + * @ares:	ACPI resource
> + * @uart:	Pointer to UARTSerialBus resource will be returned here
> + *
> + * Checks if the given ACPI resource is of type UARTSerialBus.
> + * In this case, returns a pointer to it to the caller.
> + *
> + * Returns true if resource type is of UARTSerialBus, otherwise false.
> + */
> +bool serdev_acpi_get_uart_resource(struct acpi_resource *ares,
> +				   struct acpi_resource_uart_serialbus **uart)
> +{
> +	struct acpi_resource_uart_serialbus *sb;
> +
> +	if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
> +		return false;
> +
> +	sb = &ares->data.uart_serial_bus;
> +	if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_UART)
> +		return false;
> +
> +	*uart = sb;
> +	return true;
> +}
> +EXPORT_SYMBOL_GPL(serdev_acpi_get_uart_resource);
> +
>  static int acpi_serdev_parse_resource(struct acpi_resource *ares, void *data)
>  {
>  	struct acpi_serdev_lookup *lookup = data;
>  	struct acpi_resource_uart_serialbus *sb;
>  	acpi_status status;
>  
> -	if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
> -		return 1;
> -
> -	if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
> +	if (!serdev_acpi_get_uart_resource(ares, &sb))
>  		return 1;
>  
>  	if (lookup->index != -1 && lookup->n++ != lookup->index)
>  		return 1;
>  
> -	sb = &ares->data.uart_serial_bus;
> -
>  	status = acpi_get_handle(lookup->device_handle,
>  				 sb->resource_source.string_ptr,
>  				 &lookup->controller_handle);
> @@ -586,7 +608,7 @@ static int acpi_serdev_parse_resource(struct acpi_resource *ares, void *data)
>  		return 1;
>  
>  	/*
> -	 * NOTE: Ideally, we would also want to retreive other properties here,
> +	 * NOTE: Ideally, we would also want to retrieve other properties here,
>  	 * once setting them before opening the device is supported by serdev.
>  	 */
>  
> diff --git a/include/linux/serdev.h b/include/linux/serdev.h
> index 9f14f9c12ec4..3368c261ab62 100644
> --- a/include/linux/serdev.h
> +++ b/include/linux/serdev.h
> @@ -327,4 +327,18 @@ static inline int serdev_tty_port_unregister(struct tty_port *port)
>  }
>  #endif /* CONFIG_SERIAL_DEV_CTRL_TTYPORT */
>  
> +struct acpi_resource;
> +struct acpi_resource_uart_serialbus;
> +
> +#ifdef CONFIG_ACPI
> +bool serdev_acpi_get_uart_resource(struct acpi_resource *ares,
> +				   struct acpi_resource_uart_serialbus **uart);
> +#else
> +static inline bool serdev_acpi_get_uart_resource(struct acpi_resource *ares,
> +						 struct acpi_resource_uart_serialbus **uart)
> +{
> +	return false;
> +}
> +#endif /* CONFIG_ACPI */
> +
>  #endif /*_LINUX_SERDEV_H */
> 


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

* Re: [PATCH v1 3/5] Bluetooth: hci_bcm: Use serdev_acpi_get_uart_resource() helper
  2021-08-03 19:29 ` [PATCH v1 3/5] Bluetooth: hci_bcm: " Andy Shevchenko
@ 2021-08-04  8:12   ` Hans de Goede
  2021-08-04  8:42     ` Andy Shevchenko
  0 siblings, 1 reply; 14+ messages in thread
From: Hans de Goede @ 2021-08-04  8:12 UTC (permalink / raw)
  To: Andy Shevchenko, Maximilian Luz, Lee Jones, Greg Kroah-Hartman,
	linux-bluetooth, linux-kernel, platform-driver-x86, linux-serial
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Mark Gross, Rob Herring, Jiri Slaby

Hi,

On 8/3/21 9:29 PM, Andy Shevchenko wrote:
> serdev provides a generic helper to get UART Serial Bus resources.
> Use it instead of open coded variant.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/bluetooth/hci_bcm.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
> index 3cd57fc56ade..16f854ac19b6 100644
> --- a/drivers/bluetooth/hci_bcm.c
> +++ b/drivers/bluetooth/hci_bcm.c
> @@ -899,9 +899,9 @@ static const struct acpi_gpio_mapping acpi_bcm_int_first_gpios[] = {
>  static int bcm_resource(struct acpi_resource *ares, void *data)
>  {
>  	struct bcm_device *dev = data;
> +	struct acpi_resource_uart_serialbus *uart;
>  	struct acpi_resource_extended_irq *irq;
>  	struct acpi_resource_gpio *gpio;
> -	struct acpi_resource_uart_serialbus *sb;
>  
>  	switch (ares->type) {
>  	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
> @@ -920,18 +920,15 @@ static int bcm_resource(struct acpi_resource *ares, void *data)
>  		dev->gpio_count++;
>  		break;
>  
> -	case ACPI_RESOURCE_TYPE_SERIAL_BUS:
> -		sb = &ares->data.uart_serial_bus;
> -		if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_UART) {
> -			dev->init_speed = sb->default_baud_rate;
> -			dev->oper_speed = 4000000;
> -		}
> -		break;
> -
>  	default:
>  		break;
>  	}
>  
> +	if (serdev_acpi_get_uart_resource(ares, &uart)) {
> +		dev->init_speed = uart->default_baud_rate;
> +		dev->oper_speed = 4000000;
> +	}
> +

You are replacing a nice switch-case which handles all relevant resource
types with still having a switch-case + a separate if .. else if .. else if ...
(also taking patch 4/5 into account).

This does not help the readability of this code at all IMHO, so NACK
from me for this patch as well as for 4/5.

Regards,

Hans


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

* Re: [PATCH v1 3/5] Bluetooth: hci_bcm: Use serdev_acpi_get_uart_resource() helper
  2021-08-04  8:12   ` Hans de Goede
@ 2021-08-04  8:42     ` Andy Shevchenko
  2021-08-04  9:35       ` Hans de Goede
  0 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2021-08-04  8:42 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Andy Shevchenko, Maximilian Luz, Lee Jones, Greg Kroah-Hartman,
	linux-bluetooth, Linux Kernel Mailing List, Platform Driver,
	open list:SERIAL DRIVERS, Marcel Holtmann, Johan Hedberg,
	Luiz Augusto von Dentz, Mark Gross, Rob Herring, Jiri Slaby

On Wed, Aug 4, 2021 at 11:13 AM Hans de Goede <hdegoede@redhat.com> wrote:
> On 8/3/21 9:29 PM, Andy Shevchenko wrote:
> > serdev provides a generic helper to get UART Serial Bus resources.
> > Use it instead of open coded variant.

...

> > +     if (serdev_acpi_get_uart_resource(ares, &uart)) {
> > +             dev->init_speed = uart->default_baud_rate;
> > +             dev->oper_speed = 4000000;
> > +     }
> > +
>
> You are replacing a nice switch-case which handles all relevant resource
> types with still having a switch-case + a separate if .. else if .. else if ...
> (also taking patch 4/5 into account).
>
> This does not help the readability of this code at all IMHO, so NACK
> from me for this patch as well as for 4/5.

I guess it's a matter of style. The main idea is to try avoiding the
spreading of the customized ACPI resource extraction here and there.
Probably I should have started with cleaning up the EXTENDED_IRQ case,
which seems not needed here in the current form.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v1 3/5] Bluetooth: hci_bcm: Use serdev_acpi_get_uart_resource() helper
  2021-08-04  8:42     ` Andy Shevchenko
@ 2021-08-04  9:35       ` Hans de Goede
  0 siblings, 0 replies; 14+ messages in thread
From: Hans de Goede @ 2021-08-04  9:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andy Shevchenko, Maximilian Luz, Lee Jones, Greg Kroah-Hartman,
	linux-bluetooth, Linux Kernel Mailing List, Platform Driver,
	open list:SERIAL DRIVERS, Marcel Holtmann, Johan Hedberg,
	Luiz Augusto von Dentz, Mark Gross, Rob Herring, Jiri Slaby

Hi,

On 8/4/21 10:42 AM, Andy Shevchenko wrote:
> On Wed, Aug 4, 2021 at 11:13 AM Hans de Goede <hdegoede@redhat.com> wrote:
>> On 8/3/21 9:29 PM, Andy Shevchenko wrote:
>>> serdev provides a generic helper to get UART Serial Bus resources.
>>> Use it instead of open coded variant.
> 
> ...
> 
>>> +     if (serdev_acpi_get_uart_resource(ares, &uart)) {
>>> +             dev->init_speed = uart->default_baud_rate;
>>> +             dev->oper_speed = 4000000;
>>> +     }
>>> +
>>
>> You are replacing a nice switch-case which handles all relevant resource
>> types with still having a switch-case + a separate if .. else if .. else if ...
>> (also taking patch 4/5 into account).
>>
>> This does not help the readability of this code at all IMHO, so NACK
>> from me for this patch as well as for 4/5.
> 
> I guess it's a matter of style. The main idea is to try avoiding the
> spreading of the customized ACPI resource extraction here and there.

I agree that the helpers make sense for drivers which care about 1
specific type of resource like an I2cSerialBus resource.

But in cases like this where the driver cares about all the resources
in the resource-list just doing a switch-case on the resource-type
directly in the driver just seems cleaner and it certainly is
easier to read. Helpers are nice, but every level of indirection
also means that a developer needs to go and find the function and
lookup what it does when they want to know what is exactly happening.

So lining up all these factors then just sticking with the
switch-case here seems best IMHO.

Also when there is doubt if a cleanup actually makes things
better, which there seems to be here, then it is best to simply
stick with what we have since every code-change may introduce
regressions, may make backporting fixes later more difficult, etc.

Regards,

Hans


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

* Re: [PATCH v1 1/5] serdev: Split and export serdev_acpi_get_uart_resource()
  2021-08-04  8:08 ` [PATCH v1 1/5] " Hans de Goede
@ 2021-08-04 12:07   ` Andy Shevchenko
  0 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-08-04 12:07 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Maximilian Luz, Lee Jones, Greg Kroah-Hartman, linux-bluetooth,
	linux-kernel, platform-driver-x86, linux-serial, Marcel Holtmann,
	Johan Hedberg, Luiz Augusto von Dentz, Mark Gross, Rob Herring,
	Jiri Slaby

On Wed, Aug 04, 2021 at 10:08:01AM +0200, Hans de Goede wrote:
> Hi,
> 
> On 8/3/21 9:29 PM, Andy Shevchenko wrote:
> > The same as for I²C Serial Bus resource split and export
> > serdev_acpi_get_uart_resource(). We have already 3 users
> > one of which is converted here.
> > 
> > Rationale of this is to consolidate parsing UART Serial Bus
> > resource in one place as it's done, e.g., for I²C Serial Bus.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Thanks, patch looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> 
> *for this patch*
> 
> We do need to talk about how to merge this series, I've
> NACK-ed patches 3/5 and 4/5 (see my reply there) so that
> leaves just 2/5  as depending on this one. I believe it
> would be easiest to just merge 1/5 + 2/5 to the tree
> which caries serdev patches, which I guess is Greg's
> tty tree ?

I can resend a v2 with tags and dropped mentioned patches.
I think it will be easier to everyone to handle.

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2021-08-04 12:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 19:29 [PATCH v1 1/5] serdev: Split and export serdev_acpi_get_uart_resource() Andy Shevchenko
2021-08-03 19:29 ` [PATCH v1 2/5] platform/surface: aggregator: Use serdev_acpi_get_uart_resource() helper Andy Shevchenko
2021-08-03 19:47   ` Maximilian Luz
2021-08-03 19:29 ` [PATCH v1 3/5] Bluetooth: hci_bcm: " Andy Shevchenko
2021-08-04  8:12   ` Hans de Goede
2021-08-04  8:42     ` Andy Shevchenko
2021-08-04  9:35       ` Hans de Goede
2021-08-03 19:29 ` [PATCH v1 4/5] Bluetooth: hci_bcm: Use acpi_gpio_get_*_resource() helpers Andy Shevchenko
2021-08-04  8:04   ` Hans de Goede
2021-08-03 19:29 ` [PATCH v1 5/5] Bluetooth: hci_bcm: Fix kernel doc comments Andy Shevchenko
2021-08-03 20:04 ` [v1,1/5] serdev: Split and export serdev_acpi_get_uart_resource() bluez.test.bot
2021-08-03 20:32   ` Andy Shevchenko
2021-08-04  8:08 ` [PATCH v1 1/5] " Hans de Goede
2021-08-04 12:07   ` Andy Shevchenko

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