mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] soc: qcom: apr: Drop unused apr_device_id
@ 2026-06-15 10:04 Uwe Kleine-König (The Capable Hub)
  2026-06-16  0:53 ` Dmitry Baryshkov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-15 10:04 UTC (permalink / raw)
  To: Srinivas Kandagatla, Bjorn Andersson, Konrad Dybcio
  Cc: Takashi Sakamoto, Dave Hansen, Sohil Mehta, Raag Jadav,
	Heiner Kallweit, linux-sound, linux-arm-msm, linux-kernel

apr_device_id was introduced in commit 6adba21eb434 ("soc: qcom: Add APR
bus driver") in 2018, and since then not a single driver made use of it.

So drop the unused id_table pointer from struct apr_driver and move
APR_NAME_SIZE to the apr header which still has a usage of it.

Note that with the id_table being NULL apr_device_match() degrades to just
of_driver_match_device(), so replace this callback accordingly.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/soc/qcom/apr.c          | 25 +------------------------
 include/linux/mod_devicetable.h | 11 -----------
 include/linux/soc/qcom/apr.h    |  4 ++--
 3 files changed, 3 insertions(+), 37 deletions(-)

diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c
index ea7f83916d8d..2073edb416a4 100644
--- a/drivers/soc/qcom/apr.c
+++ b/drivers/soc/qcom/apr.c
@@ -338,29 +338,6 @@ static void apr_rxwq(struct work_struct *work)
 	}
 }
 
-static int apr_device_match(struct device *dev, const struct device_driver *drv)
-{
-	struct apr_device *adev = to_apr_device(dev);
-	const struct apr_driver *adrv = to_apr_driver(drv);
-	const struct apr_device_id *id = adrv->id_table;
-
-	/* Attempt an OF style match first */
-	if (of_driver_match_device(dev, drv))
-		return 1;
-
-	if (!id)
-		return 0;
-
-	while (id->domain_id != 0 || id->svc_id != 0) {
-		if (id->domain_id == adev->domain_id &&
-		    id->svc_id == adev->svc.id)
-			return 1;
-		id++;
-	}
-
-	return 0;
-}
-
 static int apr_device_probe(struct device *dev)
 {
 	struct apr_device *adev = to_apr_device(dev);
@@ -401,7 +378,7 @@ static int apr_uevent(const struct device *dev, struct kobj_uevent_env *env)
 
 const struct bus_type aprbus = {
 	.name		= "aprbus",
-	.match		= apr_device_match,
+	.match		= of_driver_match_device,
 	.probe		= apr_device_probe,
 	.uevent		= apr_uevent,
 	.remove		= apr_device_remove,
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 7f44057aa65e..d74ff3ee1424 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -547,17 +547,6 @@ struct slim_device_id {
 	kernel_ulong_t driver_data;
 };
 
-#define APR_NAME_SIZE	32
-#define APR_MODULE_PREFIX "apr:"
-
-struct apr_device_id {
-	char name[APR_NAME_SIZE];
-	__u32 domain_id;
-	__u32 svc_id;
-	__u32 svc_version;
-	kernel_ulong_t driver_data;	/* Data private to the driver */
-};
-
 #define SPMI_NAME_SIZE	32
 #define SPMI_MODULE_PREFIX "spmi:"
 
diff --git a/include/linux/soc/qcom/apr.h b/include/linux/soc/qcom/apr.h
index 58fa1df96347..2e4231092088 100644
--- a/include/linux/soc/qcom/apr.h
+++ b/include/linux/soc/qcom/apr.h
@@ -5,7 +5,6 @@
 
 #include <linux/spinlock.h>
 #include <linux/device.h>
-#include <linux/mod_devicetable.h>
 #include <dt-bindings/soc/qcom,apr.h>
 #include <dt-bindings/soc/qcom,gpr.h>
 
@@ -135,6 +134,8 @@ struct pkt_router_svc {
 
 typedef struct pkt_router_svc gpr_port_t;
 
+#define APR_NAME_SIZE   32
+
 struct apr_device {
 	struct device	dev;
 	uint16_t	svc_id;
@@ -158,7 +159,6 @@ struct apr_driver {
 			    const struct apr_resp_pkt *d);
 	gpr_port_cb gpr_callback;
 	struct device_driver		driver;
-	const struct apr_device_id	*id_table;
 };
 
 typedef struct apr_driver gpr_driver_t;

base-commit: c425609d6ac4012c8bbf01ec2e10e801b1923a7b
-- 
2.47.3


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

* Re: [PATCH v1] soc: qcom: apr: Drop unused apr_device_id
  2026-06-15 10:04 [PATCH v1] soc: qcom: apr: Drop unused apr_device_id Uwe Kleine-König (The Capable Hub)
@ 2026-06-16  0:53 ` Dmitry Baryshkov
  2026-06-16 20:46 ` Srinivas Kandagatla
  2026-07-01 15:20 ` Uwe Kleine-König (The Capable Hub)
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2026-06-16  0:53 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: Srinivas Kandagatla, Bjorn Andersson, Konrad Dybcio,
	Takashi Sakamoto, Dave Hansen, Sohil Mehta, Raag Jadav,
	Heiner Kallweit, linux-sound, linux-arm-msm, linux-kernel

On Mon, Jun 15, 2026 at 12:04:28PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> apr_device_id was introduced in commit 6adba21eb434 ("soc: qcom: Add APR
> bus driver") in 2018, and since then not a single driver made use of it.
> 
> So drop the unused id_table pointer from struct apr_driver and move
> APR_NAME_SIZE to the apr header which still has a usage of it.
> 
> Note that with the id_table being NULL apr_device_match() degrades to just
> of_driver_match_device(), so replace this callback accordingly.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---
>  drivers/soc/qcom/apr.c          | 25 +------------------------
>  include/linux/mod_devicetable.h | 11 -----------
>  include/linux/soc/qcom/apr.h    |  4 ++--
>  3 files changed, 3 insertions(+), 37 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry

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

* Re: [PATCH v1] soc: qcom: apr: Drop unused apr_device_id
  2026-06-15 10:04 [PATCH v1] soc: qcom: apr: Drop unused apr_device_id Uwe Kleine-König (The Capable Hub)
  2026-06-16  0:53 ` Dmitry Baryshkov
@ 2026-06-16 20:46 ` Srinivas Kandagatla
  2026-07-01 15:20 ` Uwe Kleine-König (The Capable Hub)
  2 siblings, 0 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2026-06-16 20:46 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub),
	Srinivas Kandagatla, Bjorn Andersson, Konrad Dybcio
  Cc: Takashi Sakamoto, Dave Hansen, Sohil Mehta, Raag Jadav,
	Heiner Kallweit, linux-sound, linux-arm-msm, linux-kernel



On 6/15/26 11:04 AM, Uwe Kleine-König (The Capable Hub) wrote:
> apr_device_id was introduced in commit 6adba21eb434 ("soc: qcom: Add APR
> bus driver") in 2018, and since then not a single driver made use of it.
> 
> So drop the unused id_table pointer from struct apr_driver and move
> APR_NAME_SIZE to the apr header which still has a usage of it.
> 
> Note that with the id_table being NULL apr_device_match() degrades to just
> of_driver_match_device(), so replace this callback accordingly.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---

Thanks for the cleanup.


Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>


>  drivers/soc/qcom/apr.c          | 25 +------------------------
>  include/linux/mod_devicetable.h | 11 -----------
>  include/linux/soc/qcom/apr.h    |  4 ++--
>  3 files changed, 3 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c
> index ea7f83916d8d..2073edb416a4 100644
> --- a/drivers/soc/qcom/apr.c
> +++ b/drivers/soc/qcom/apr.c
> @@ -338,29 +338,6 @@ static void apr_rxwq(struct work_struct *work)
>  	}
>  }
>  
> -static int apr_device_match(struct device *dev, const struct device_driver *drv)
> -{
> -	struct apr_device *adev = to_apr_device(dev);
> -	const struct apr_driver *adrv = to_apr_driver(drv);
> -	const struct apr_device_id *id = adrv->id_table;
> -
> -	/* Attempt an OF style match first */
> -	if (of_driver_match_device(dev, drv))
> -		return 1;
> -
> -	if (!id)
> -		return 0;
> -
> -	while (id->domain_id != 0 || id->svc_id != 0) {
> -		if (id->domain_id == adev->domain_id &&
> -		    id->svc_id == adev->svc.id)
> -			return 1;
> -		id++;
> -	}
> -
> -	return 0;
> -}
> -
>  static int apr_device_probe(struct device *dev)
>  {
>  	struct apr_device *adev = to_apr_device(dev);
> @@ -401,7 +378,7 @@ static int apr_uevent(const struct device *dev, struct kobj_uevent_env *env)
>  
>  const struct bus_type aprbus = {
>  	.name		= "aprbus",
> -	.match		= apr_device_match,
> +	.match		= of_driver_match_device,
>  	.probe		= apr_device_probe,
>  	.uevent		= apr_uevent,
>  	.remove		= apr_device_remove,
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 7f44057aa65e..d74ff3ee1424 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -547,17 +547,6 @@ struct slim_device_id {
>  	kernel_ulong_t driver_data;
>  };
>  
> -#define APR_NAME_SIZE	32
> -#define APR_MODULE_PREFIX "apr:"
> -
> -struct apr_device_id {
> -	char name[APR_NAME_SIZE];
> -	__u32 domain_id;
> -	__u32 svc_id;
> -	__u32 svc_version;
> -	kernel_ulong_t driver_data;	/* Data private to the driver */
> -};
> -
>  #define SPMI_NAME_SIZE	32
>  #define SPMI_MODULE_PREFIX "spmi:"
>  
> diff --git a/include/linux/soc/qcom/apr.h b/include/linux/soc/qcom/apr.h
> index 58fa1df96347..2e4231092088 100644
> --- a/include/linux/soc/qcom/apr.h
> +++ b/include/linux/soc/qcom/apr.h
> @@ -5,7 +5,6 @@
>  
>  #include <linux/spinlock.h>
>  #include <linux/device.h>
> -#include <linux/mod_devicetable.h>
>  #include <dt-bindings/soc/qcom,apr.h>
>  #include <dt-bindings/soc/qcom,gpr.h>
>  
> @@ -135,6 +134,8 @@ struct pkt_router_svc {
>  
>  typedef struct pkt_router_svc gpr_port_t;
>  
> +#define APR_NAME_SIZE   32
> +
>  struct apr_device {
>  	struct device	dev;
>  	uint16_t	svc_id;
> @@ -158,7 +159,6 @@ struct apr_driver {
>  			    const struct apr_resp_pkt *d);
>  	gpr_port_cb gpr_callback;
>  	struct device_driver		driver;
> -	const struct apr_device_id	*id_table;
>  };
>  
>  typedef struct apr_driver gpr_driver_t;
> 
> base-commit: c425609d6ac4012c8bbf01ec2e10e801b1923a7b


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

* Re: [PATCH v1] soc: qcom: apr: Drop unused apr_device_id
  2026-06-15 10:04 [PATCH v1] soc: qcom: apr: Drop unused apr_device_id Uwe Kleine-König (The Capable Hub)
  2026-06-16  0:53 ` Dmitry Baryshkov
  2026-06-16 20:46 ` Srinivas Kandagatla
@ 2026-07-01 15:20 ` Uwe Kleine-König (The Capable Hub)
  2 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-07-01 15:20 UTC (permalink / raw)
  To: Srinivas Kandagatla, Bjorn Andersson, Konrad Dybcio
  Cc: Takashi Sakamoto, Dave Hansen, Sohil Mehta, Raag Jadav,
	Heiner Kallweit, linux-sound, linux-arm-msm, linux-kernel

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

Hello,

On Mon, Jun 15, 2026 at 12:04:28PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> apr_device_id was introduced in commit 6adba21eb434 ("soc: qcom: Add APR
> bus driver") in 2018, and since then not a single driver made use of it.
> 
> So drop the unused id_table pointer from struct apr_driver and move
> APR_NAME_SIZE to the apr header which still has a usage of it.
> 
> Note that with the id_table being NULL apr_device_match() degrades to just
> of_driver_match_device(), so replace this callback accordingly.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---
>  drivers/soc/qcom/apr.c          | 25 +------------------------
>  include/linux/mod_devicetable.h | 11 -----------
>  include/linux/soc/qcom/apr.h    |  4 ++--
>  3 files changed, 3 insertions(+), 37 deletions(-)

Just a heads-up: If you apply this patch now, it will conflict with
https://lore.kernel.org/all/cover.1782808460.git.u.kleine-koenig@baylibre.com/
that I expect to go into 7.2-rc2.

I intend to send a v2 of this patch once -rc2 is out (and if my
expectation turns out to be true).

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2026-07-01 15:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-15 10:04 [PATCH v1] soc: qcom: apr: Drop unused apr_device_id Uwe Kleine-König (The Capable Hub)
2026-06-16  0:53 ` Dmitry Baryshkov
2026-06-16 20:46 ` Srinivas Kandagatla
2026-07-01 15:20 ` Uwe Kleine-König (The Capable Hub)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®