linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Ortiz <sameo@linux.intel.com>
To: Shikha SINGH <shikha.singh@st.com>
Cc: "aloisio.almeida@openbossa.org" <aloisio.almeida@openbossa.org>,
	"lauro.venancio@openbossa.org" <lauro.venancio@openbossa.org>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"linux-nfc@lists.01.org" <linux-nfc@lists.01.org>,
	Raunaque Mujeeb QUAISER <raunaque.quaiser@st.com>,
	Manoj KUMAR <manoj.kumar@st.com>,
	Sylvain FIDELIS <sylvain.fidelis@st.com>,
	Patrick SOHN <patrick.sohn@st.com>,
	MMS_MMY_Applications_SW <MMS_MMY_Applications_SW@list.st.com>
Subject: Re: [[linux-nfc] PATCH v5 2/3] driver: nfc: Add ST95HF NFC Transceiver support
Date: Mon, 21 Dec 2015 23:45:35 +0100	[thread overview]
Message-ID: <20151221224535.GA15902@zurbaran.home> (raw)
In-Reply-To: <39576D76C6222946921EC3820C1BEC0C06FEFED225@EAPEX1MAIL1.st.com>

Hi Shikha,

On Mon, Dec 21, 2015 at 07:57:23PM +0800, Shikha SINGH wrote:
> Hello Samuel,
> 	Please see my answer below.
> 	
> >This looks a lot better than the initial version.
> >I only have one question:
> >
> >On Fri, Nov 20, 2015 at 06:40:20AM -0500, Shikha Singh wrote:
> >> +/*
> >> + * st95hf_send_recv_cmd() is for sending commands to ST95HF
> >> + * that are described in the cmd_array[]. It can optionally
> >> + * receive the response if the cmd request is of type
> >> + * SYNC. For that to happen caller must pass true to recv_res.
> >> + * For ASYNC request, recv_res is ignored and the
> >> + * function will never try to receive the response on behalf
> >> + * of the caller.
> >> + */
> >> +static int st95hf_send_recv_cmd(struct st95hf_context *st95context,
> >> +				enum st95hf_cmd_list cmd,
> >> +				int no_modif,
> >> +				struct param_list *list_array,
> >> +				bool recv_res)
> >> +{
> >> +	unsigned char spi_cmd_buffer[MAX_CMD_LEN];
> >> +	int i, ret;
> >> +	struct device *dev = &st95context->spicontext.spidev->dev;
> >How do you know this driver is still valid at that point ?
> >It seems to be a potential corner case against the driver's remove function, but
> >it seems to be a race nevertheless.
> 
> st95hf_send_recv_cmd() is a static function that can be called only when a NFC digital request is submitted to our driver.
> So in summary, it can be called either from an implemented NFC digital ops (such as st95hf_switch_rf()) or from the driver's threaded ISR.
> Now if we see the remove function of the driver i.e. st95hf_remove(), it waits for all the outstanding NFC digital request to finish via nfc_digital_unregister_device(stcontext->ddev).
>
Yes, that was my main concern but I forgot
nfc_digital_unregister_device() waits for its command workqueue to be
emptied before returning. So we're safe.

All 3 patches applied to nfc-next, thanks.

Cheers,
Samuel.

  reply	other threads:[~2015-12-21 22:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-20 11:40 [[linux-nfc] PATCH v5 0/3] *** ST95HF driver v5 *** Shikha Singh
2015-11-20 11:40 ` [[linux-nfc] PATCH v5 1/3] NFC: digital: Add Type4A tags support Shikha Singh
2015-11-20 11:40 ` [[linux-nfc] PATCH v5 2/3] driver: nfc: Add ST95HF NFC Transceiver support Shikha Singh
2015-12-20 17:50   ` Samuel Ortiz
2015-12-21 11:57     ` Shikha SINGH
2015-12-21 22:45       ` Samuel Ortiz [this message]
2015-12-21 23:26         ` [linux-nfc] [ " Samuel Ortiz
2015-11-20 11:40 ` [[linux-nfc] PATCH v5 3/3] DT: bindings: net: nfc: Add ST95HF binding doc Shikha Singh

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=20151221224535.GA15902@zurbaran.home \
    --to=sameo@linux.intel.com \
    --cc=MMS_MMY_Applications_SW@list.st.com \
    --cc=aloisio.almeida@openbossa.org \
    --cc=lauro.venancio@openbossa.org \
    --cc=linux-nfc@lists.01.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=manoj.kumar@st.com \
    --cc=patrick.sohn@st.com \
    --cc=raunaque.quaiser@st.com \
    --cc=shikha.singh@st.com \
    --cc=sylvain.fidelis@st.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).