linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: Bing Zhao <bzhao@marvell.com>
Cc: linux-wireless@vger.kernel.org,
	Amitkumar Karwar <akarwar@marvell.com>,
	Avinash Patil <patila@marvell.com>,
	Yogesh Ashok Powar <yogeshp@marvell.com>,
	Nishant Sarmukadam <nishants@marvell.com>,
	Frank Huang <frankh@marvell.com>
Subject: Re: [PATCH 19/21] mwifiex: code rearrangement in sdio.c
Date: Wed, 24 Jul 2013 11:17:07 -0400	[thread overview]
Message-ID: <20130724151706.GE2385@tuxdriver.com> (raw)
In-Reply-To: <1374545878-15683-20-git-send-email-bzhao@marvell.com>

This one also did not apply on the current wireless-next...

On Mon, Jul 22, 2013 at 07:17:56PM -0700, Bing Zhao wrote:
> From: Amitkumar Karwar <akarwar@marvell.com>
> 
> Some function definitions are moved to appropriate place
> to avoid forward declarations.
> 
> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
> Signed-off-by: Bing Zhao <bzhao@marvell.com>
> ---
>  drivers/net/wireless/mwifiex/sdio.c | 211 ++++++++++++++++++------------------
>  1 file changed, 104 insertions(+), 107 deletions(-)
> 
> diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
> index c32a735..1eb5efa1 100644
> --- a/drivers/net/wireless/mwifiex/sdio.c
> +++ b/drivers/net/wireless/mwifiex/sdio.c
> @@ -50,9 +50,6 @@ static struct mwifiex_if_ops sdio_ops;
>  
>  static struct semaphore add_remove_card_sem;
>  
> -static int mwifiex_sdio_resume(struct device *dev);
> -static void mwifiex_sdio_interrupt(struct sdio_func *func);
> -
>  /*
>   * SDIO probe.
>   *
> @@ -113,6 +110,51 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
>  }
>  
>  /*
> + * SDIO resume.
> + *
> + * Kernel needs to suspend all functions separately. Therefore all
> + * registered functions must have drivers with suspend and resume
> + * methods. Failing that the kernel simply removes the whole card.
> + *
> + * If already not resumed, this function turns on the traffic and
> + * sends a host sleep cancel request to the firmware.
> + */
> +static int mwifiex_sdio_resume(struct device *dev)
> +{
> +	struct sdio_func *func = dev_to_sdio_func(dev);
> +	struct sdio_mmc_card *card;
> +	struct mwifiex_adapter *adapter;
> +	mmc_pm_flag_t pm_flag = 0;
> +
> +	if (func) {
> +		pm_flag = sdio_get_host_pm_caps(func);
> +		card = sdio_get_drvdata(func);
> +		if (!card || !card->adapter) {
> +			pr_err("resume: invalid card or adapter\n");
> +			return 0;
> +		}
> +	} else {
> +		pr_err("resume: sdio_func is not specified\n");
> +		return 0;
> +	}
> +
> +	adapter = card->adapter;
> +
> +	if (!adapter->is_suspended) {
> +		dev_warn(adapter->dev, "device already resumed\n");
> +		return 0;
> +	}
> +
> +	adapter->is_suspended = false;
> +
> +	/* Disable Host Sleep */
> +	mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
> +			  MWIFIEX_ASYNC_CMD);
> +
> +	return 0;
> +}
> +
> +/*
>   * SDIO remove.
>   *
>   * This function removes the interface and frees up the card structure.
> @@ -212,51 +254,6 @@ static int mwifiex_sdio_suspend(struct device *dev)
>  	return ret;
>  }
>  
> -/*
> - * SDIO resume.
> - *
> - * Kernel needs to suspend all functions separately. Therefore all
> - * registered functions must have drivers with suspend and resume
> - * methods. Failing that the kernel simply removes the whole card.
> - *
> - * If already not resumed, this function turns on the traffic and
> - * sends a host sleep cancel request to the firmware.
> - */
> -static int mwifiex_sdio_resume(struct device *dev)
> -{
> -	struct sdio_func *func = dev_to_sdio_func(dev);
> -	struct sdio_mmc_card *card;
> -	struct mwifiex_adapter *adapter;
> -	mmc_pm_flag_t pm_flag = 0;
> -
> -	if (func) {
> -		pm_flag = sdio_get_host_pm_caps(func);
> -		card = sdio_get_drvdata(func);
> -		if (!card || !card->adapter) {
> -			pr_err("resume: invalid card or adapter\n");
> -			return 0;
> -		}
> -	} else {
> -		pr_err("resume: sdio_func is not specified\n");
> -		return 0;
> -	}
> -
> -	adapter = card->adapter;
> -
> -	if (!adapter->is_suspended) {
> -		dev_warn(adapter->dev, "device already resumed\n");
> -		return 0;
> -	}
> -
> -	adapter->is_suspended = false;
> -
> -	/* Disable Host Sleep */
> -	mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
> -			  MWIFIEX_ASYNC_CMD);
> -
> -	return 0;
> -}
> -
>  /* Device ID for SD8786 */
>  #define SDIO_DEVICE_ID_MARVELL_8786   (0x9116)
>  /* Device ID for SD8787 */
> @@ -707,6 +704,65 @@ static void mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter)
>  }
>  
>  /*
> + * This function reads the interrupt status from card.
> + */
> +static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter)
> +{
> +	struct sdio_mmc_card *card = adapter->card;
> +	u8 sdio_ireg;
> +	unsigned long flags;
> +
> +	if (mwifiex_read_data_sync(adapter, card->mp_regs,
> +				   card->reg->max_mp_regs,
> +				   REG_PORT | MWIFIEX_SDIO_BYTE_MODE_MASK, 0)) {
> +		dev_err(adapter->dev, "read mp_regs failed\n");
> +		return;
> +	}
> +
> +	sdio_ireg = card->mp_regs[HOST_INTSTATUS_REG];
> +	if (sdio_ireg) {
> +		/*
> +		 * DN_LD_HOST_INT_STATUS and/or UP_LD_HOST_INT_STATUS
> +		 * For SDIO new mode CMD port interrupts
> +		 *	DN_LD_CMD_PORT_HOST_INT_STATUS and/or
> +		 *	UP_LD_CMD_PORT_HOST_INT_STATUS
> +		 * Clear the interrupt status register
> +		 */
> +		dev_dbg(adapter->dev, "int: sdio_ireg = %#x\n", sdio_ireg);
> +		spin_lock_irqsave(&adapter->int_lock, flags);
> +		adapter->int_status |= sdio_ireg;
> +		spin_unlock_irqrestore(&adapter->int_lock, flags);
> +	}
> +}
> +
> +/*
> + * SDIO interrupt handler.
> + *
> + * This function reads the interrupt status from firmware and handles
> + * the interrupt in current thread (ksdioirqd) right away.
> + */
> +static void
> +mwifiex_sdio_interrupt(struct sdio_func *func)
> +{
> +	struct mwifiex_adapter *adapter;
> +	struct sdio_mmc_card *card;
> +
> +	card = sdio_get_drvdata(func);
> +	if (!card || !card->adapter) {
> +		pr_debug("int: func=%p card=%p adapter=%p\n",
> +			 func, card, card ? card->adapter : NULL);
> +		return;
> +	}
> +	adapter = card->adapter;
> +
> +	if (!adapter->pps_uapsd_mode && adapter->ps_state == PS_STATE_SLEEP)
> +		adapter->ps_state = PS_STATE_AWAKE;
> +
> +	mwifiex_interrupt_status(adapter);
> +	mwifiex_main_process(adapter);
> +}
> +
> +/*
>   * This function enables the host interrupt.
>   *
>   * The host interrupt enable mask is written to the card
> @@ -963,65 +1019,6 @@ static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter,
>  }
>  
>  /*
> - * This function reads the interrupt status from card.
> - */
> -static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter)
> -{
> -	struct sdio_mmc_card *card = adapter->card;
> -	u8 sdio_ireg;
> -	unsigned long flags;
> -
> -	if (mwifiex_read_data_sync(adapter, card->mp_regs,
> -				   card->reg->max_mp_regs,
> -				   REG_PORT | MWIFIEX_SDIO_BYTE_MODE_MASK, 0)) {
> -		dev_err(adapter->dev, "read mp_regs failed\n");
> -		return;
> -	}
> -
> -	sdio_ireg = card->mp_regs[HOST_INTSTATUS_REG];
> -	if (sdio_ireg) {
> -		/*
> -		 * DN_LD_HOST_INT_STATUS and/or UP_LD_HOST_INT_STATUS
> -		 * For SDIO new mode CMD port interrupts
> -		 *	DN_LD_CMD_PORT_HOST_INT_STATUS and/or
> -		 *	UP_LD_CMD_PORT_HOST_INT_STATUS
> -		 * Clear the interrupt status register
> -		 */
> -		dev_dbg(adapter->dev, "int: sdio_ireg = %#x\n", sdio_ireg);
> -		spin_lock_irqsave(&adapter->int_lock, flags);
> -		adapter->int_status |= sdio_ireg;
> -		spin_unlock_irqrestore(&adapter->int_lock, flags);
> -	}
> -}
> -
> -/*
> - * SDIO interrupt handler.
> - *
> - * This function reads the interrupt status from firmware and handles
> - * the interrupt in current thread (ksdioirqd) right away.
> - */
> -static void
> -mwifiex_sdio_interrupt(struct sdio_func *func)
> -{
> -	struct mwifiex_adapter *adapter;
> -	struct sdio_mmc_card *card;
> -
> -	card = sdio_get_drvdata(func);
> -	if (!card || !card->adapter) {
> -		pr_debug("int: func=%p card=%p adapter=%p\n",
> -			 func, card, card ? card->adapter : NULL);
> -		return;
> -	}
> -	adapter = card->adapter;
> -
> -	if (!adapter->pps_uapsd_mode && adapter->ps_state == PS_STATE_SLEEP)
> -		adapter->ps_state = PS_STATE_AWAKE;
> -
> -	mwifiex_interrupt_status(adapter);
> -	mwifiex_main_process(adapter);
> -}
> -
> -/*
>   * This function decodes a received packet.
>   *
>   * Based on the type, the packet is treated as either a data, or
> -- 
> 1.8.2.3
> 
> 

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

  reply	other threads:[~2013-07-24 15:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23  2:17 [PATCH 00/21] mwifiex updates for 3.12 Bing Zhao
2013-07-23  2:17 ` [PATCH 01/21] mwifiex: remove stop_net_dev_queue operation in AP forwarding Bing Zhao
2013-07-23  2:17 ` [PATCH 02/21] mwifiex: rename pkt_count to ba_pkt_count in mwifiex_ra_list_tbl struct Bing Zhao
2013-07-23  2:17 ` [PATCH 03/21] mwifiex: maintain outstanding packet count for RA list instead of packet size Bing Zhao
2013-07-23  2:17 ` [PATCH 04/21] mwifiex: delete AP TX queues when bridged packets reach threshold Bing Zhao
2013-07-23  2:17 ` [PATCH 05/21] mwifiex: add tx info to skb when forming mgmt frame Bing Zhao
2013-07-23  2:17 ` [PATCH 06/21] mwifiex: discard deauth and disassoc event during WPS session Bing Zhao
2013-07-23  2:17 ` [PATCH 07/21] mwifiex: skip registering mgmt frame that has already registered Bing Zhao
2013-07-23  2:17 ` [PATCH 08/21] mwifiex: support to send deauth for P2P client Bing Zhao
2013-07-23  2:17 ` [PATCH 09/21] mwifiex: correct max IE length check for WPS IE Bing Zhao
2013-07-23  2:17 ` [PATCH 10/21] mwifiex: add PCIe shutdown handler to avoid system hang on reboot Bing Zhao
2013-07-23  2:17 ` [PATCH 11/21] mwifiex: move del_timer_sync(scan_delay_timer) call to fix memleak Bing Zhao
2013-07-23  2:17 ` [PATCH 12/21] mwifiex: remove unnecessary del_timer(cmd_timer) Bing Zhao
2013-07-23  2:17 ` [PATCH 13/21] mwifiex: move if_ops.cleanup_if() call Bing Zhao
2013-07-23  2:17 ` [PATCH 14/21] mwifiex: add unregister_dev handler for usb interface Bing Zhao
2013-07-23  2:17 ` [PATCH 15/21] mwifiex: reduce firmware poll retries Bing Zhao
2013-07-23  2:17 ` [PATCH 16/21] mwifiex: replace mdelay with msleep Bing Zhao
2013-07-23  2:17 ` [PATCH 17/21] mwifiex: correction in mwifiex_check_fw_status() return status Bing Zhao
2013-07-23  2:17 ` [PATCH 18/21] mwifiex: handle driver initialization error paths Bing Zhao
2013-07-24 15:16   ` John W. Linville
2013-07-24 18:48     ` Bing Zhao
2013-07-24 19:02       ` John W. Linville
2013-07-26  4:25         ` Bing Zhao
2013-07-23  2:17 ` [PATCH 19/21] mwifiex: code rearrangement in sdio.c Bing Zhao
2013-07-24 15:17   ` John W. Linville [this message]
2013-07-23  2:17 ` [PATCH 20/21] mwifiex: remove duplicate structure host_cmd_tlv Bing Zhao
2013-07-23  2:17 ` [PATCH 21/21] mwifiex: modify mwifiex_ap_sta_limits to advertise support for P2P Bing Zhao

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=20130724151706.GE2385@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=akarwar@marvell.com \
    --cc=bzhao@marvell.com \
    --cc=frankh@marvell.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nishants@marvell.com \
    --cc=patila@marvell.com \
    --cc=yogeshp@marvell.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 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).