From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] SPI: Add i.MX ECSPI driver
Date: Sat, 14 Jan 2012 20:04:14 -0500 [thread overview]
Message-ID: <201201142004.15662.vapier@gentoo.org> (raw)
In-Reply-To: <1326382034-31058-1-git-send-email-dirk.behme@de.bosch.com>
On Thursday 12 January 2012 10:27:13 Dirk Behme wrote:
> +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
> + unsigned int max_hz, unsigned int mode)
> +{
> + struct imx_spi_dev_t *imx_spi_slave = NULL;
setting to NULL is kind of pointless when you init it immediately below
> + imx_spi_slave = (struct imx_spi_dev_t *)
> + calloc(sizeof(struct imx_spi_dev_t), 1);
no need for that cast on the return of calloc
> + spi_get_cfg(imx_spi_slave);
> + spi_io_init(imx_spi_slave, 0);
i don't see these funcs defined anywhere in this patch. since they aren't part
of the common SPI API, you should namespace them accordingly (like with an SoC
prefix or something).
> + spi_reset(&(imx_spi_slave->slave));
the inner params are not needed. also, programming of hardware does not
happen in the spi_setup_slave() step. that's what the spi_claim_bus() is for.
> + return &(imx_spi_slave->slave);
drop the paren
> +void spi_free_slave(struct spi_slave *slave)
> +{
> + struct imx_spi_dev_t *imx_spi_slave;
> +
> + if (slave) {
> + imx_spi_slave = to_imx_spi_slave(slave);
> + free(imx_spi_slave);
> + }
> +}
the NULL check on "slave" is not necessary. we assume everywhere else that it
is valid ahead of time.
> +int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen,
> + const u8 *dout, u8 *din, unsigned long flags)
static
> + if (spi_reg->ctrl_reg == 0) {
> + printf("Error: spi(base=0x%x) has not been initialized yet\n",
> + dev->base);
not necessary either ... we don't bother supporting broken callers in the bus
drivers
> +int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void
> + *dout, void *din, unsigned long flags)
> ...
> + if (!slave)
> + return -1;
not necessary either
> +int spi_cs_is_valid(unsigned int bus, unsigned int cs)
> +{
> + return 1;
> +}
this can't be right ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120114/dd879533/attachment.pgp>
prev parent reply other threads:[~2012-01-15 1:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-12 15:27 [U-Boot] [PATCH 1/2] SPI: Add i.MX ECSPI driver Dirk Behme
2012-01-12 15:27 ` [U-Boot] [PATCH 2/2] i.mx6q: SabreLite: Add SPI NOR support Dirk Behme
2012-01-12 15:32 ` Fabio Estevam
2012-01-12 15:38 ` Marek Vasut
2012-01-12 15:48 ` Fabio Estevam
2012-01-13 7:19 ` Dirk Behme
2012-01-15 1:05 ` Mike Frysinger
2012-01-15 1:04 ` Mike Frysinger
2012-01-12 15:37 ` [U-Boot] [PATCH 1/2] SPI: Add i.MX ECSPI driver Marek Vasut
2012-01-13 7:32 ` Dirk Behme
2012-01-13 12:17 ` Marek Vasut
2012-01-12 15:40 ` Fabio Estevam
2012-01-13 10:48 ` Stefano Babic
2012-01-13 11:45 ` Dirk Behme
2012-01-16 17:29 ` Eric Nelson
2012-01-16 17:38 ` Stefano Babic
2012-01-15 1:04 ` Mike Frysinger [this message]
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=201201142004.15662.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.