All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform-msi: Do not cache msi_desc in handler_data
@ 2015-09-13 12:37 Marc Zyngier
  2015-09-14  2:25 ` Jiang Liu
  2015-09-15 15:48 ` [tip:irq/urgent] " tip-bot for Marc Zyngier
  0 siblings, 2 replies; 3+ messages in thread
From: Marc Zyngier @ 2015-09-13 12:37 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Ma Jun, linux-kernel, Jiang Liu

The current implementation of platform MSI caches the msi_desc
pointer in irq_data::handler_data. This is a bit silly, as
we also have irq_data::msi_desc, which is perfectly valid.

Remove the useless assignment and simplify the whole flow.

Reported-by: Ma Jun <majun258@huawei.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/base/platform-msi.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c
index 1857a5d..134483d 100644
--- a/drivers/base/platform-msi.c
+++ b/drivers/base/platform-msi.c
@@ -63,20 +63,8 @@ static int platform_msi_init(struct irq_domain *domain,
 			     unsigned int virq, irq_hw_number_t hwirq,
 			     msi_alloc_info_t *arg)
 {
-	struct irq_data *data;
-
-	irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
-				      info->chip, info->chip_data);
-
-	/*
-	 * Save the MSI descriptor in handler_data so that the
-	 * irq_write_msi_msg callback can retrieve it (and the
-	 * associated device).
-	 */
-	data = irq_domain_get_irq_data(domain, virq);
-	data->handler_data = arg->desc;
-
-	return 0;
+	return irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
+					     info->chip, info->chip_data);
 }
 #else
 #define platform_msi_set_desc		NULL
@@ -97,7 +85,7 @@ static void platform_msi_update_dom_ops(struct msi_domain_info *info)
 
 static void platform_msi_write_msg(struct irq_data *data, struct msi_msg *msg)
 {
-	struct msi_desc *desc = irq_data_get_irq_handler_data(data);
+	struct msi_desc *desc = irq_data_get_msi_desc(data);
 	struct platform_msi_priv_data *priv_data;
 
 	priv_data = desc->platform.msi_priv_data;
-- 
2.1.4


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

* Re: [PATCH] platform-msi: Do not cache msi_desc in handler_data
  2015-09-13 12:37 [PATCH] platform-msi: Do not cache msi_desc in handler_data Marc Zyngier
@ 2015-09-14  2:25 ` Jiang Liu
  2015-09-15 15:48 ` [tip:irq/urgent] " tip-bot for Marc Zyngier
  1 sibling, 0 replies; 3+ messages in thread
From: Jiang Liu @ 2015-09-14  2:25 UTC (permalink / raw)
  To: Marc Zyngier, Thomas Gleixner; +Cc: Ma Jun, linux-kernel

On 2015/9/13 20:37, Marc Zyngier wrote:
> The current implementation of platform MSI caches the msi_desc
> pointer in irq_data::handler_data. This is a bit silly, as
> we also have irq_data::msi_desc, which is perfectly valid.
> 
> Remove the useless assignment and simplify the whole flow.
> 
> Reported-by: Ma Jun <majun258@huawei.com>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Jiang Liu <jiang.liu@linux.intel.com>



> ---
>  drivers/base/platform-msi.c | 18 +++---------------
>  1 file changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c
> index 1857a5d..134483d 100644
> --- a/drivers/base/platform-msi.c
> +++ b/drivers/base/platform-msi.c
> @@ -63,20 +63,8 @@ static int platform_msi_init(struct irq_domain *domain,
>  			     unsigned int virq, irq_hw_number_t hwirq,
>  			     msi_alloc_info_t *arg)
>  {
> -	struct irq_data *data;
> -
> -	irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
> -				      info->chip, info->chip_data);
> -
> -	/*
> -	 * Save the MSI descriptor in handler_data so that the
> -	 * irq_write_msi_msg callback can retrieve it (and the
> -	 * associated device).
> -	 */
> -	data = irq_domain_get_irq_data(domain, virq);
> -	data->handler_data = arg->desc;
> -
> -	return 0;
> +	return irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
> +					     info->chip, info->chip_data);
>  }
>  #else
>  #define platform_msi_set_desc		NULL
> @@ -97,7 +85,7 @@ static void platform_msi_update_dom_ops(struct msi_domain_info *info)
>  
>  static void platform_msi_write_msg(struct irq_data *data, struct msi_msg *msg)
>  {
> -	struct msi_desc *desc = irq_data_get_irq_handler_data(data);
> +	struct msi_desc *desc = irq_data_get_msi_desc(data);
>  	struct platform_msi_priv_data *priv_data;
>  
>  	priv_data = desc->platform.msi_priv_data;
> 

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

* [tip:irq/urgent] platform-msi: Do not cache msi_desc in handler_data
  2015-09-13 12:37 [PATCH] platform-msi: Do not cache msi_desc in handler_data Marc Zyngier
  2015-09-14  2:25 ` Jiang Liu
@ 2015-09-15 15:48 ` tip-bot for Marc Zyngier
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Marc Zyngier @ 2015-09-15 15:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jiang.liu, hpa, majun258, mingo, tglx, linux-kernel, marc.zyngier

Commit-ID:  e4084a16bbe07957811c75dfb7c9bf25c5862ba0
Gitweb:     http://git.kernel.org/tip/e4084a16bbe07957811c75dfb7c9bf25c5862ba0
Author:     Marc Zyngier <marc.zyngier@arm.com>
AuthorDate: Sun, 13 Sep 2015 13:37:03 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 15 Sep 2015 17:06:29 +0200

platform-msi: Do not cache msi_desc in handler_data

The current implementation of platform MSI caches the msi_desc
pointer in irq_data::handler_data. This is a bit silly, as
we also have irq_data::msi_desc, which is perfectly valid.

Remove the useless assignment and simplify the whole flow.

Reported-by: Ma Jun <majun258@huawei.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Jiang Liu <jiang.liu@linux.intel.com>
Link: http://lkml.kernel.org/r/1442147824-20971-1-git-send-email-marc.zyngier@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/base/platform-msi.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c
index 1857a5d..134483d 100644
--- a/drivers/base/platform-msi.c
+++ b/drivers/base/platform-msi.c
@@ -63,20 +63,8 @@ static int platform_msi_init(struct irq_domain *domain,
 			     unsigned int virq, irq_hw_number_t hwirq,
 			     msi_alloc_info_t *arg)
 {
-	struct irq_data *data;
-
-	irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
-				      info->chip, info->chip_data);
-
-	/*
-	 * Save the MSI descriptor in handler_data so that the
-	 * irq_write_msi_msg callback can retrieve it (and the
-	 * associated device).
-	 */
-	data = irq_domain_get_irq_data(domain, virq);
-	data->handler_data = arg->desc;
-
-	return 0;
+	return irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
+					     info->chip, info->chip_data);
 }
 #else
 #define platform_msi_set_desc		NULL
@@ -97,7 +85,7 @@ static void platform_msi_update_dom_ops(struct msi_domain_info *info)
 
 static void platform_msi_write_msg(struct irq_data *data, struct msi_msg *msg)
 {
-	struct msi_desc *desc = irq_data_get_irq_handler_data(data);
+	struct msi_desc *desc = irq_data_get_msi_desc(data);
 	struct platform_msi_priv_data *priv_data;
 
 	priv_data = desc->platform.msi_priv_data;

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

end of thread, other threads:[~2015-09-15 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-13 12:37 [PATCH] platform-msi: Do not cache msi_desc in handler_data Marc Zyngier
2015-09-14  2:25 ` Jiang Liu
2015-09-15 15:48 ` [tip:irq/urgent] " tip-bot for Marc Zyngier

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.