All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Arend van Spriel" <arend@broadcom.com>
To: "Nathan Hintz" <nlhintz@hotmail.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org, hauke@hauke-m.de
Subject: Re: [PATCH v3 1/6] bcma: Find names of non BCM cores
Date: Sat, 5 May 2012 08:16:10 +0200	[thread overview]
Message-ID: <4FA4C5AA.1080008@broadcom.com> (raw)
In-Reply-To: <BLU0-SMTP19886E577929273F2D9108CAC2D0@phx.gbl>

On 05/05/2012 06:56 AM, Nathan Hintz wrote:
> bcma_device_name only provides names for Broadcom cores.  Modify logic to
> provide names for MIPS and ARM cores as well.

The description does not seem accurate. In my opinion the aim is to make
the device name lookup a little bit more efficient by moving from one
lookup table to a lookup table per vendor.

> Signed-off-by: Nathan Hintz <nlhintz@hotmail.com>
> ---
>  drivers/bcma/scan.c |   54 +++++++++++++++++++++++++++++++++++++-------------
>  1 files changed, 40 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
> index f94cccc..e19e987 100644
> --- a/drivers/bcma/scan.c
> +++ b/drivers/bcma/scan.c
> @@ -19,7 +19,14 @@ struct bcma_device_id_name {
>  	u16 id;
>  	const char *name;
>  };
> -struct bcma_device_id_name bcma_device_names[] = {
> +
> +static const struct bcma_device_id_name bcma_arm_device_names[] = {
> +	{ BCMA_CORE_ARM_1176, "ARM 1176" },
> +	{ BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
> +	{ BCMA_CORE_ARM_CM3, "ARM CM3" },
> +};
> +
> +static const struct bcma_device_id_name bcma_bcm_device_names[] = {
>  	{ BCMA_CORE_OOB_ROUTER, "OOB Router" },
>  	{ BCMA_CORE_INVALID, "Invalid" },
>  	{ BCMA_CORE_CHIPCOMMON, "ChipCommon" },
> @@ -27,7 +34,6 @@ struct bcma_device_id_name bcma_device_names[] = {
>  	{ BCMA_CORE_SRAM, "SRAM" },
>  	{ BCMA_CORE_SDRAM, "SDRAM" },
>  	{ BCMA_CORE_PCI, "PCI" },
> -	{ BCMA_CORE_MIPS, "MIPS" },
>  	{ BCMA_CORE_ETHERNET, "Fast Ethernet" },
>  	{ BCMA_CORE_V90, "V90" },
>  	{ BCMA_CORE_USB11_HOSTDEV, "USB 1.1 Hostdev" },
> @@ -44,7 +50,6 @@ struct bcma_device_id_name bcma_device_names[] = {
>  	{ BCMA_CORE_PHY_A, "PHY A" },
>  	{ BCMA_CORE_PHY_B, "PHY B" },
>  	{ BCMA_CORE_PHY_G, "PHY G" },
> -	{ BCMA_CORE_MIPS_3302, "MIPS 3302" },
>  	{ BCMA_CORE_USB11_HOST, "USB 1.1 Host" },
>  	{ BCMA_CORE_USB11_DEV, "USB 1.1 Device" },
>  	{ BCMA_CORE_USB20_HOST, "USB 2.0 Host" },
> @@ -58,15 +63,11 @@ struct bcma_device_id_name bcma_device_names[] = {
>  	{ BCMA_CORE_PHY_N, "PHY N" },
>  	{ BCMA_CORE_SRAM_CTL, "SRAM Controller" },
>  	{ BCMA_CORE_MINI_MACPHY, "Mini MACPHY" },
> -	{ BCMA_CORE_ARM_1176, "ARM 1176" },
> -	{ BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
>  	{ BCMA_CORE_PHY_LP, "PHY LP" },
>  	{ BCMA_CORE_PMU, "PMU" },
>  	{ BCMA_CORE_PHY_SSN, "PHY SSN" },
>  	{ BCMA_CORE_SDIO_DEV, "SDIO Device" },
> -	{ BCMA_CORE_ARM_CM3, "ARM CM3" },
>  	{ BCMA_CORE_PHY_HT, "PHY HT" },
> -	{ BCMA_CORE_MIPS_74K, "MIPS 74K" },
>  	{ BCMA_CORE_MAC_GBIT, "GBit MAC" },
>  	{ BCMA_CORE_DDR12_MEM_CTL, "DDR1/DDR2 Memory Controller" },
>  	{ BCMA_CORE_PCIE_RC, "PCIe Root Complex" },
> @@ -79,16 +80,41 @@ struct bcma_device_id_name bcma_device_names[] = {
>  	{ BCMA_CORE_SHIM, "SHIM" },
>  	{ BCMA_CORE_DEFAULT, "Default" },
>  };
> -const char *bcma_device_name(struct bcma_device_id *id)
> +
> +static const struct bcma_device_id_name bcma_mips_device_names[] = {
> +	{ BCMA_CORE_MIPS, "MIPS" },
> +	{ BCMA_CORE_MIPS_3302, "MIPS 3302" },
> +	{ BCMA_CORE_MIPS_74K, "MIPS 74K" },
> +};
> +
> +static const char *bcma_device_name(const struct bcma_device_id *id)
>  {
> -	int i;
> +	const struct bcma_device_id_name *names;
> +	int size, i;
> +
> +	/* search manufacturer specific names */
> +	switch (id->manuf) {
> +	case BCMA_MANUF_ARM:
> +		names = bcma_arm_device_names;
> +		size = ARRAY_SIZE(bcma_arm_device_names);
> +		break;
> +	case BCMA_MANUF_BCM:
> +		names = bcma_bcm_device_names;
> +		size = ARRAY_SIZE(bcma_bcm_device_names);
> +		break;
> +	case BCMA_MANUF_MIPS:
> +		names = bcma_mips_device_names;
> +		size = ARRAY_SIZE(bcma_mips_device_names);
> +		break;
> +	default:
> +		return "UNKNOWN";
> +	}
>  
> -	if (id->manuf == BCMA_MANUF_BCM) {
> -		for (i = 0; i < ARRAY_SIZE(bcma_device_names); i++) {
> -			if (bcma_device_names[i].id == id->id)
> -				return bcma_device_names[i].name;
> -		}
> +	for (i = 0; i < size; i++) {
> +		if (names[i].id == id->id)
> +			return names[i].name;
>  	}
> +
>  	return "UNKNOWN";
>  }
>  



  reply	other threads:[~2012-05-05  6:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1336193796-32599-1-git-send-email-nlhintz@hotmail.com>
2012-05-05  4:56 ` [PATCH v3 1/6] bcma: Find names of non BCM cores Nathan Hintz
2012-05-05  6:16   ` Arend van Spriel [this message]
2012-05-05  7:23     ` Nathan Hintz
2012-05-05  4:56 ` [PATCH v3 2/6] bcma: Move initialization of SPROM to prevent overwrite Nathan Hintz
2012-05-05  4:56 ` [PATCH v3 3/6] bcma: Account for variable PCI memory base/size Nathan Hintz
2012-05-05  4:56 ` [PATCH v3 4/6] bcma: reads/writes are always 4 bytes, so always map 4 bytes Nathan Hintz
2012-05-05  4:56 ` [PATCH v3 5/6] bcma: Add __devexit to bcma_host_pci_remove Nathan Hintz
2012-05-05  4:56 ` [PATCH v3 6/6] bcma: Add flush for BCMA_RESET_CTL write Nathan Hintz
2012-05-05  6:03   ` Arend van Spriel
2012-05-05  7:50     ` Nathan Hintz
2012-05-05 12:41       ` Hauke Mehrtens
2012-05-05 20:40         ` Arend van Spriel
2012-05-06 18:07           ` Nathan Hintz
2012-05-06 20:48             ` Arend van Spriel
2012-12-11  7:44               ` Nathan Hintz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FA4C5AA.1080008@broadcom.com \
    --to=arend@broadcom.com \
    --cc=hauke@hauke-m.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=nlhintz@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.