diff mbox

[1/3] spi: spi.h: clarify the documentation of transfer_one

Message ID 39ffc897bd2e5fd48a3141ed4cd122a80c5bbb20.1390544495.git.baruch@tkos.co.il (mailing list archive)
State Accepted
Headers show

Commit Message

Baruch Siach Jan. 24, 2014, 6:28 a.m. UTC
Explicitly note the transfer_one and transfer_one_message are mutually
exclusive, to make the text a little more newcomers friendly.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 include/linux/spi/spi.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Geert Uytterhoeven Jan. 24, 2014, 7:44 a.m. UTC | #1
On Fri, Jan 24, 2014 at 7:28 AM, Baruch Siach <baruch@tkos.co.il> wrote:
> --- a/include/linux/spi/spi.h
> +++ b/include/linux/spi/spi.h
> @@ -285,7 +285,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
>   * @transfer_one: transfer a single spi_transfer. When the
>   *               driver is finished with this transfer it must call
>   *               spi_finalize_current_transfer() so the subsystem can issue
> - *                the next transfer
> + *                the next transfer. Note: transfer_one and
> + *                transfer_one_message are mutually exclusive; when both are
> + *                set, transfer_one takes precedence.

I find this a bit difficult to grasp. What does "take precedence" mean in
this context?

The default spi_transfer_one_message() uses .transfer_one().
But if .transfer_one_message() is set, it depends on your own driver if
.transfer_one() is used or not.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Baruch Siach Jan. 24, 2014, 8:12 a.m. UTC | #2
Hi Gerrt,

On Fri, Jan 24, 2014 at 08:44:32AM +0100, Geert Uytterhoeven wrote:
> On Fri, Jan 24, 2014 at 7:28 AM, Baruch Siach <baruch@tkos.co.il> wrote:
> > --- a/include/linux/spi/spi.h
> > +++ b/include/linux/spi/spi.h
> > @@ -285,7 +285,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
> >   * @transfer_one: transfer a single spi_transfer. When the
> >   *               driver is finished with this transfer it must call
> >   *               spi_finalize_current_transfer() so the subsystem can issue
> > - *                the next transfer
> > + *                the next transfer. Note: transfer_one and
> > + *                transfer_one_message are mutually exclusive; when both are
> > + *                set, transfer_one takes precedence.
> 
> I find this a bit difficult to grasp. What does "take precedence" mean in
> this context?
> 
> The default spi_transfer_one_message() uses .transfer_one().
> But if .transfer_one_message() is set, it depends on your own driver if
> .transfer_one() is used or not.

Of course. I misread the code. How about this:

Note: transfer_one and transfer_one_message are mutually exclusive; when both 
are set, the transfer_one callback is not called by the generic subsystem.

Thanks again,
baruch
Geert Uytterhoeven Jan. 24, 2014, 8:31 a.m. UTC | #3
On Fri, Jan 24, 2014 at 9:12 AM, Baruch Siach <baruch@tkos.co.il> wrote:
>> > @@ -285,7 +285,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
>> >   * @transfer_one: transfer a single spi_transfer. When the
>> >   *               driver is finished with this transfer it must call
>> >   *               spi_finalize_current_transfer() so the subsystem can issue
>> > - *                the next transfer
>> > + *                the next transfer. Note: transfer_one and
>> > + *                transfer_one_message are mutually exclusive; when both are
>> > + *                set, transfer_one takes precedence.
>>
>> I find this a bit difficult to grasp. What does "take precedence" mean in
>> this context?
>>
>> The default spi_transfer_one_message() uses .transfer_one().
>> But if .transfer_one_message() is set, it depends on your own driver if
>> .transfer_one() is used or not.
>
> Of course. I misread the code. How about this:
>
> Note: transfer_one and transfer_one_message are mutually exclusive; when both
> are set, the transfer_one callback is not called by the generic subsystem.

Sounds fine to me, thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 8c62ba74dd91..060b21e82e73 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -285,7 +285,9 @@  static inline void spi_unregister_driver(struct spi_driver *sdrv)
  * @transfer_one: transfer a single spi_transfer. When the
  *	          driver is finished with this transfer it must call
  *	          spi_finalize_current_transfer() so the subsystem can issue
- *                the next transfer
+ *                the next transfer. Note: transfer_one and
+ *                transfer_one_message are mutually exclusive; when both are
+ *                set, transfer_one takes precedence.
  * @unprepare_message: undo any work done by prepare_message().
  * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
  *	number. Any individual value may be -ENOENT for CS lines that