All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bcma: clean bus initialiation code
@ 2015-01-16 19:18 Rafał Miłecki
  2015-01-16 19:59 ` [PATCH V2] bcma: clean bus initialization code Rafał Miłecki
  0 siblings, 1 reply; 8+ messages in thread
From: Rafał Miłecki @ 2015-01-16 19:18 UTC (permalink / raw)
  To: Kalle Valo, linux-wireless; +Cc: Hauke Mehrtens, Rafał Miłecki

This moves main bus init code to the main.c and renames old function to
make its purpose clear.
Thanks to this change we'll also be able to separate scanning from
registration (and support PCIe Gen 2 devices) in the future.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/bcma/bcma_private.h |  3 ++-
 drivers/bcma/main.c         | 16 ++++++++++++----
 drivers/bcma/scan.c         |  5 +----
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
index 314ae40..08fa58a 100644
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
@@ -25,6 +25,7 @@ struct bcma_bus;
 bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
 		     int timeout);
 void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
+void bcma_init_bus(struct bcma_bus *bus);
 int bcma_bus_register(struct bcma_bus *bus);
 void bcma_bus_unregister(struct bcma_bus *bus);
 int __init bcma_bus_early_register(struct bcma_bus *bus,
@@ -40,7 +41,7 @@ int bcma_bus_scan(struct bcma_bus *bus);
 int __init bcma_bus_scan_early(struct bcma_bus *bus,
 			       struct bcma_device_id *match,
 			       struct bcma_device *core);
-void bcma_init_bus(struct bcma_bus *bus);
+void bcma_detect_chip(struct bcma_bus *bus);
 
 /* sprom.c */
 int bcma_sprom_get(struct bcma_bus *bus);
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 534e133..c166d44 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -268,6 +268,18 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
 	}
 }
 
+void bcma_init_bus(struct bcma_bus *bus)
+{
+	mutex_lock(&bcma_buses_mutex);
+	bus->num = bcma_bus_next_num++;
+	mutex_unlock(&bcma_buses_mutex);
+
+	INIT_LIST_HEAD(&bus->cores);
+	bus->nr_cores = 0;
+
+	bcma_detect_chip(bus);
+}
+
 static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
 {
 	int err;
@@ -369,10 +381,6 @@ int bcma_bus_register(struct bcma_bus *bus)
 	int err;
 	struct bcma_device *core;
 
-	mutex_lock(&bcma_buses_mutex);
-	bus->num = bcma_bus_next_num++;
-	mutex_unlock(&bcma_buses_mutex);
-
 	/* Scan for devices (cores) */
 	err = bcma_bus_scan(bus);
 	if (err) {
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
index 9175207..5328ee5 100644
--- a/drivers/bcma/scan.c
+++ b/drivers/bcma/scan.c
@@ -435,15 +435,12 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
 	return 0;
 }
 
-void bcma_init_bus(struct bcma_bus *bus)
+void bcma_detect_chip(struct bcma_bus *bus)
 {
 	s32 tmp;
 	struct bcma_chipinfo *chipinfo = &(bus->chipinfo);
 	char chip_id[8];
 
-	INIT_LIST_HEAD(&bus->cores);
-	bus->nr_cores = 0;
-
 	bcma_scan_switch_core(bus, BCMA_ADDR_BASE);
 
 	tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID);
-- 
1.8.4.5


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

* [PATCH V2] bcma: clean bus initialization code
  2015-01-16 19:18 [PATCH] bcma: clean bus initialiation code Rafał Miłecki
@ 2015-01-16 19:59 ` Rafał Miłecki
  2015-01-18 18:35   ` Hauke Mehrtens
  2015-01-23 17:49   ` Kalle Valo
  0 siblings, 2 replies; 8+ messages in thread
From: Rafał Miłecki @ 2015-01-16 19:59 UTC (permalink / raw)
  To: Kalle Valo, linux-wireless; +Cc: Hauke Mehrtens, Rafał Miłecki

This moves main bus init code to the main.c and renames old function to
make its purpose clear.
Thanks to this change we'll also be able to separate scanning from
registration (and support PCIe Gen 2 devices) in the future.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
V2: Fix typo (s/initialiation/initialization/)
    Put bcma_detect_chip earlier in .h to match order in .c
---
 drivers/bcma/bcma_private.h |  3 ++-
 drivers/bcma/main.c         | 16 ++++++++++++----
 drivers/bcma/scan.c         |  5 +----
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
index 314ae40..59422b5 100644
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
@@ -25,6 +25,7 @@ struct bcma_bus;
 bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
 		     int timeout);
 void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
+void bcma_init_bus(struct bcma_bus *bus);
 int bcma_bus_register(struct bcma_bus *bus);
 void bcma_bus_unregister(struct bcma_bus *bus);
 int __init bcma_bus_early_register(struct bcma_bus *bus,
@@ -36,11 +37,11 @@ int bcma_bus_resume(struct bcma_bus *bus);
 #endif
 
 /* scan.c */
+void bcma_detect_chip(struct bcma_bus *bus);
 int bcma_bus_scan(struct bcma_bus *bus);
 int __init bcma_bus_scan_early(struct bcma_bus *bus,
 			       struct bcma_device_id *match,
 			       struct bcma_device *core);
-void bcma_init_bus(struct bcma_bus *bus);
 
 /* sprom.c */
 int bcma_sprom_get(struct bcma_bus *bus);
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 534e133..c166d44 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -268,6 +268,18 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
 	}
 }
 
+void bcma_init_bus(struct bcma_bus *bus)
+{
+	mutex_lock(&bcma_buses_mutex);
+	bus->num = bcma_bus_next_num++;
+	mutex_unlock(&bcma_buses_mutex);
+
+	INIT_LIST_HEAD(&bus->cores);
+	bus->nr_cores = 0;
+
+	bcma_detect_chip(bus);
+}
+
 static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
 {
 	int err;
@@ -369,10 +381,6 @@ int bcma_bus_register(struct bcma_bus *bus)
 	int err;
 	struct bcma_device *core;
 
-	mutex_lock(&bcma_buses_mutex);
-	bus->num = bcma_bus_next_num++;
-	mutex_unlock(&bcma_buses_mutex);
-
 	/* Scan for devices (cores) */
 	err = bcma_bus_scan(bus);
 	if (err) {
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
index 9175207..5328ee5 100644
--- a/drivers/bcma/scan.c
+++ b/drivers/bcma/scan.c
@@ -435,15 +435,12 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
 	return 0;
 }
 
-void bcma_init_bus(struct bcma_bus *bus)
+void bcma_detect_chip(struct bcma_bus *bus)
 {
 	s32 tmp;
 	struct bcma_chipinfo *chipinfo = &(bus->chipinfo);
 	char chip_id[8];
 
-	INIT_LIST_HEAD(&bus->cores);
-	bus->nr_cores = 0;
-
 	bcma_scan_switch_core(bus, BCMA_ADDR_BASE);
 
 	tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID);
-- 
1.8.4.5


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

* Re: [PATCH V2] bcma: clean bus initialization code
  2015-01-16 19:59 ` [PATCH V2] bcma: clean bus initialization code Rafał Miłecki
@ 2015-01-18 18:35   ` Hauke Mehrtens
  2015-01-22 14:01     ` Kalle Valo
  2015-01-23 17:49   ` Kalle Valo
  1 sibling, 1 reply; 8+ messages in thread
From: Hauke Mehrtens @ 2015-01-18 18:35 UTC (permalink / raw)
  To: Rafał Miłecki, Kalle Valo, linux-wireless

On 01/16/2015 08:59 PM, Rafał Miłecki wrote:
> This moves main bus init code to the main.c and renames old function to
> make its purpose clear.
> Thanks to this change we'll also be able to separate scanning from
> registration (and support PCIe Gen 2 devices) in the future.
> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

This should also fix the problem that the bus number in the early init
part was wrongly set to 0. I saw this on a SoC with BCMA as main bus and
some PCIe cards with bcma on it.

> ---
> V2: Fix typo (s/initialiation/initialization/)
>     Put bcma_detect_chip earlier in .h to match order in .c
> ---
>  drivers/bcma/bcma_private.h |  3 ++-
>  drivers/bcma/main.c         | 16 ++++++++++++----
>  drivers/bcma/scan.c         |  5 +----
>  3 files changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
> index 314ae40..59422b5 100644
> --- a/drivers/bcma/bcma_private.h
> +++ b/drivers/bcma/bcma_private.h
> @@ -25,6 +25,7 @@ struct bcma_bus;
>  bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
>  		     int timeout);
>  void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
> +void bcma_init_bus(struct bcma_bus *bus);
>  int bcma_bus_register(struct bcma_bus *bus);
>  void bcma_bus_unregister(struct bcma_bus *bus);
>  int __init bcma_bus_early_register(struct bcma_bus *bus,
> @@ -36,11 +37,11 @@ int bcma_bus_resume(struct bcma_bus *bus);
>  #endif
>  
>  /* scan.c */
> +void bcma_detect_chip(struct bcma_bus *bus);
>  int bcma_bus_scan(struct bcma_bus *bus);
>  int __init bcma_bus_scan_early(struct bcma_bus *bus,
>  			       struct bcma_device_id *match,
>  			       struct bcma_device *core);
> -void bcma_init_bus(struct bcma_bus *bus);
>  
>  /* sprom.c */
>  int bcma_sprom_get(struct bcma_bus *bus);
> diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
> index 534e133..c166d44 100644
> --- a/drivers/bcma/main.c
> +++ b/drivers/bcma/main.c
> @@ -268,6 +268,18 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
>  	}
>  }
>  
> +void bcma_init_bus(struct bcma_bus *bus)
> +{
> +	mutex_lock(&bcma_buses_mutex);
> +	bus->num = bcma_bus_next_num++;
> +	mutex_unlock(&bcma_buses_mutex);
> +
> +	INIT_LIST_HEAD(&bus->cores);
> +	bus->nr_cores = 0;
> +
> +	bcma_detect_chip(bus);
> +}
> +
>  static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
>  {
>  	int err;
> @@ -369,10 +381,6 @@ int bcma_bus_register(struct bcma_bus *bus)
>  	int err;
>  	struct bcma_device *core;
>  
> -	mutex_lock(&bcma_buses_mutex);
> -	bus->num = bcma_bus_next_num++;
> -	mutex_unlock(&bcma_buses_mutex);
> -
>  	/* Scan for devices (cores) */
>  	err = bcma_bus_scan(bus);
>  	if (err) {
> diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
> index 9175207..5328ee5 100644
> --- a/drivers/bcma/scan.c
> +++ b/drivers/bcma/scan.c
> @@ -435,15 +435,12 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
>  	return 0;
>  }
>  
> -void bcma_init_bus(struct bcma_bus *bus)
> +void bcma_detect_chip(struct bcma_bus *bus)
>  {
>  	s32 tmp;
>  	struct bcma_chipinfo *chipinfo = &(bus->chipinfo);
>  	char chip_id[8];
>  
> -	INIT_LIST_HEAD(&bus->cores);
> -	bus->nr_cores = 0;
> -
>  	bcma_scan_switch_core(bus, BCMA_ADDR_BASE);
>  
>  	tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID);
> 


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

* Re: [PATCH V2] bcma: clean bus initialization code
  2015-01-18 18:35   ` Hauke Mehrtens
@ 2015-01-22 14:01     ` Kalle Valo
  2015-01-22 20:55       ` Hauke Mehrtens
  0 siblings, 1 reply; 8+ messages in thread
From: Kalle Valo @ 2015-01-22 14:01 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: Rafał Miłecki, linux-wireless

Hauke Mehrtens <hauke@hauke-m.de> writes:

> On 01/16/2015 08:59 PM, Rafał Miłecki wrote:
>> This moves main bus init code to the main.c and renames old function to
>> make its purpose clear.
>> Thanks to this change we'll also be able to separate scanning from
>> registration (and support PCIe Gen 2 devices) in the future.
>> 
>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

No need to change anything now, but I think that in cases like this you
should use Acked-by:

  "13) When to use Acked-by: and Cc:

  The Signed-off-by: tag indicates that the signer was involved in the
  development of the patch, or that he/she was in the patch's delivery
  path.

  If a person was not directly involved in the preparation or handling
  of a patch but wishes to signify and record their approval of it then
  they can arrange to have an Acked-by: line added to the patch's
  changelog.

  Acked-by: is often used by the maintainer of the affected code when
  that maintainer neither contributed to nor forwarded the patch."


-- 
Kalle Valo

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

* Re: [PATCH V2] bcma: clean bus initialization code
  2015-01-22 14:01     ` Kalle Valo
@ 2015-01-22 20:55       ` Hauke Mehrtens
  0 siblings, 0 replies; 8+ messages in thread
From: Hauke Mehrtens @ 2015-01-22 20:55 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Rafał Miłecki, linux-wireless

On 01/22/2015 03:01 PM, Kalle Valo wrote:
> Hauke Mehrtens <hauke@hauke-m.de> writes:
> 
>> On 01/16/2015 08:59 PM, Rafał Miłecki wrote:
>>> This moves main bus init code to the main.c and renames old function to
>>> make its purpose clear.
>>> Thanks to this change we'll also be able to separate scanning from
>>> registration (and support PCIe Gen 2 devices) in the future.
>>>
>>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
>>
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> 
> No need to change anything now, but I think that in cases like this you
> should use Acked-by:
> 
>   "13) When to use Acked-by: and Cc:
> 
>   The Signed-off-by: tag indicates that the signer was involved in the
>   development of the patch, or that he/she was in the patch's delivery
>   path.
> 
>   If a person was not directly involved in the preparation or handling
>   of a patch but wishes to signify and record their approval of it then
>   they can arrange to have an Acked-by: line added to the patch's
>   changelog.
> 
>   Acked-by: is often used by the maintainer of the affected code when
>   that maintainer neither contributed to nor forwarded the patch."
> 
> 
Yes you are right I thought about that right after I send clicked on
send. Sorry.

Hauke

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

* Re: [PATCH V2] bcma: clean bus initialization code
  2015-01-16 19:59 ` [PATCH V2] bcma: clean bus initialization code Rafał Miłecki
  2015-01-18 18:35   ` Hauke Mehrtens
@ 2015-01-23 17:49   ` Kalle Valo
  2015-01-23 19:16     ` Rafał Miłecki
  1 sibling, 1 reply; 8+ messages in thread
From: Kalle Valo @ 2015-01-23 17:49 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, Hauke Mehrtens

Rafał Miłecki <zajec5@gmail.com> writes:

> This moves main bus init code to the main.c and renames old function to
> make its purpose clear.
> Thanks to this change we'll also be able to separate scanning from
> registration (and support PCIe Gen 2 devices) in the future.
>
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
> V2: Fix typo (s/initialiation/initialization/)
>     Put bcma_detect_chip earlier in .h to match order in .c

Thanks, applied to wireless-drivers-next.git. But to avoid any UTF-8
problems I applied this one manually from email. 'git log' and gitk look
good to me, but please do check still that the log is valid.

-- 
Kalle Valo

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

* Re: [PATCH V2] bcma: clean bus initialization code
  2015-01-23 17:49   ` Kalle Valo
@ 2015-01-23 19:16     ` Rafał Miłecki
  2015-01-23 19:30       ` Kalle Valo
  0 siblings, 1 reply; 8+ messages in thread
From: Rafał Miłecki @ 2015-01-23 19:16 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, Hauke Mehrtens

On 23 January 2015 at 18:49, Kalle Valo <kvalo@codeaurora.org> wrote:
> Rafał Miłecki <zajec5@gmail.com> writes:
>
>> This moves main bus init code to the main.c and renames old function to
>> make its purpose clear.
>> Thanks to this change we'll also be able to separate scanning from
>> registration (and support PCIe Gen 2 devices) in the future.
>>
>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
>> ---
>> V2: Fix typo (s/initialiation/initialization/)
>>     Put bcma_detect_chip earlier in .h to match order in .c
>
> Thanks, applied to wireless-drivers-next.git. But to avoid any UTF-8
> problems I applied this one manually from email. 'git log' and gitk look
> good to me, but please do check still that the log is valid.

Looks great, thanks.

I hope kernel.org team will upgrade patchwork soon so I can send more patches :|

-- 
Rafał

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

* Re: [PATCH V2] bcma: clean bus initialization code
  2015-01-23 19:16     ` Rafał Miłecki
@ 2015-01-23 19:30       ` Kalle Valo
  0 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2015-01-23 19:30 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, Hauke Mehrtens

Rafał Miłecki <zajec5@gmail.com> writes:

> On 23 January 2015 at 18:49, Kalle Valo <kvalo@codeaurora.org> wrote:
>> Rafał Miłecki <zajec5@gmail.com> writes:
>>
>>> This moves main bus init code to the main.c and renames old function to
>>> make its purpose clear.
>>> Thanks to this change we'll also be able to separate scanning from
>>> registration (and support PCIe Gen 2 devices) in the future.
>>>
>>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
>>> ---
>>> V2: Fix typo (s/initialiation/initialization/)
>>>     Put bcma_detect_chip earlier in .h to match order in .c
>>
>> Thanks, applied to wireless-drivers-next.git. But to avoid any UTF-8
>> problems I applied this one manually from email. 'git log' and gitk look
>> good to me, but please do check still that the log is valid.
>
> Looks great, thanks.

Thanks for checking.

> I hope kernel.org team will upgrade patchwork soon so I can send more
> patches :|

It might take some time, they (or is it just one person?) seem to be
quite busy. Just continue sending patches and I'll apply them manually.
Luckily you seem to be the only one using non-ascii characters.

-- 
Kalle Valo

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

end of thread, other threads:[~2015-01-23 19:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-16 19:18 [PATCH] bcma: clean bus initialiation code Rafał Miłecki
2015-01-16 19:59 ` [PATCH V2] bcma: clean bus initialization code Rafał Miłecki
2015-01-18 18:35   ` Hauke Mehrtens
2015-01-22 14:01     ` Kalle Valo
2015-01-22 20:55       ` Hauke Mehrtens
2015-01-23 17:49   ` Kalle Valo
2015-01-23 19:16     ` Rafał Miłecki
2015-01-23 19:30       ` Kalle Valo

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.