Subject: Re: [PATCH net 5/5] qlcnic: reset firmware API lock during driver load

From: Sergei Shtylyov <[email-masked]>
Date: Fri, 21 Feb 2014 18:36:29 +0400

Hello.

On 21-02-2014 10:23, Shahed Shaikh wrote:

> From: Sony Chacko <[email-masked]>

> Firmware is not resetting API lock at initialization,
> reset the lock at driver load time.

> Signed-off-by: Sony Chacko <[email-masked]>
> ---
>   drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)

> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> index 1222865..61f8893 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> @@ -2305,6 +2305,18 @@ void qlcnic_set_drv_version(struct qlcnic_adapter *adapter)
>   		qlcnic_fw_cmd_set_drv_version(adapter, fw_cmd);
>   }
>
> +static void qlcnic_reset_api_lock(struct qlcnic_adapter *adapter)
> +{
> +	/* Check lock availability*/
> +	if (qlcnic_api_lock(adapter)) {
> +		/* Lock not available, force release the lock */
> +		qlcnic_api_unlock(adapter);
> +	} else {
> +		/* Lock available, release it before proceeding */
> +		qlcnic_api_unlock(adapter);
> +	}

    Isn't it simpler to just do:

	qlcnic_api_lock(adapter);
	qlcnic_api_unlock(adapter);

> +}
> +
>   static int
>   qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>   {

WBR, Sergei