linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pelle Nilsson <per.nilsson-5TWeZ6kPplYAvxtiuMwx3w@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	nios2-dev-g9ZBwUv/Ih/yUk5EbOjzuce+I+R0W71w@public.gmane.org
Subject: Re: [PATCH 1/1] spi: altera: Add empty implementation of setup_transfer callback
Date: Thu, 09 Apr 2015 17:50:52 +0200	[thread overview]
Message-ID: <55269FDC.8040306@xelmo.com> (raw)
In-Reply-To: <20150409154045.GZ6023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>

On 2015-04-09 17:40, Mark Brown wrote:
> Why is the callback mandatory if an empty implementation is OK?

Ask the author of spi-bitbang. :-)

In spi_bitbang_start() we have this chunk of code:

	if (!bitbang->txrx_bufs) {
		bitbang->use_dma = 0;
		bitbang->txrx_bufs = spi_bitbang_bufs;
		if (!master->setup) {
			if (!bitbang->setup_transfer)
				bitbang->setup_transfer =
					 spi_bitbang_setup_transfer;
			master->setup = spi_bitbang_setup;
			master->cleanup = spi_bitbang_cleanup;
		}
	}

As can be seen here, if setup_transfer is NULL (not set by the
specific driver), it is filled in with the default callback function
spi_bitbang_setup_transfer(), but only if txrx_bufs is also NULL,
which is not the case here.

There is a comment in spi-xilinx also stating this fact (though their
implementation isn't actually empty anymore):

/* spi_bitbang requires custom setup_transfer() to be defined if there
is a
 * custom txrx_bufs().
 */
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-04-09 15:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09 15:03 [PATCH 0/1] Fix NULL pointer dereference Pelle Nilsson
     [not found] ` <1428591822-24279-1-git-send-email-per.nilsson-5TWeZ6kPplYAvxtiuMwx3w@public.gmane.org>
2015-04-09 15:03   ` [PATCH 1/1] spi: altera: Add empty implementation of setup_transfer callback Pelle Nilsson
     [not found]     ` <1428591822-24279-2-git-send-email-per.nilsson-5TWeZ6kPplYAvxtiuMwx3w@public.gmane.org>
2015-04-09 15:40       ` Mark Brown
     [not found]         ` <20150409154045.GZ6023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-04-09 15:50           ` Pelle Nilsson [this message]
     [not found]             ` <55269FDC.8040306-5TWeZ6kPplYAvxtiuMwx3w@public.gmane.org>
2015-04-09 16:10               ` Mark Brown
2015-04-13  9:45                 ` Pelle Nilsson
     [not found]                   ` <552B9045.4040709-5TWeZ6kPplYAvxtiuMwx3w@public.gmane.org>
2015-04-13 10:08                     ` [PATCH] spi: bitbang: Make setup_transfer callback optional Pelle Nilsson
     [not found]                       ` <1428919685-14190-1-git-send-email-per.nilsson-5TWeZ6kPplYAvxtiuMwx3w@public.gmane.org>
2015-04-14  0:22                         ` [Nios2-dev] " Ezequiel Garcia
2015-04-14 13:40                         ` [PATCH v2] spi: bitbang: Make setup_transfer() " Pelle Nilsson
     [not found]                           ` <1429018817-18117-1-git-send-email-per.nilsson-5TWeZ6kPplYAvxtiuMwx3w@public.gmane.org>
2015-04-14 15:36                             ` Ezequiel Garcia
2015-04-18 11:00                             ` Mark Brown
2015-04-09 15:26   ` [PATCH 0/1] Fix NULL pointer dereference Mark Brown
2015-04-09 15:54   ` [PATCH v2] spi: altera: Add empty implementation of setup_transfer callback Pelle Nilsson
     [not found]     ` <1428594853-24640-1-git-send-email-per.nilsson-5TWeZ6kPplYAvxtiuMwx3w@public.gmane.org>
2015-04-09 16:23       ` Mark Brown

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=55269FDC.8040306@xelmo.com \
    --to=per.nilsson-5twez6kpplyavxtiumwx3w@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nios2-dev-g9ZBwUv/Ih/yUk5EbOjzuce+I+R0W71w@public.gmane.org \
    /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).