linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: plagnioj@jcrosoft.com (Jean-Christophe PLAGNIOL-VILLARD)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/8 v2] mfd: add U8500 STw4500 SPI device support
Date: Tue, 6 Oct 2009 23:08:02 +0200	[thread overview]
Message-ID: <20091006210802.GA26904@game.jcrosoft.org> (raw)
In-Reply-To: <1253735370.21542.179.camel@vinay-desktop>

> + * SPI protocol &  before it writes it packs the data
> + * in the below 24 bit frame format
> + *
> + *	 *|------------------------------------|
> + *	 *| 23|22...18|17.......10|9|8|7......0|
> + *	 *| r/w  bank       adr          data  |
> + *	 * ------------------------------------
> + *
> + * This function shouldn't be called from interrupt
> + * context
> + */
> +int stw4500_write(struct stw4500 *stw4500, unsigned char block,
> +		unsigned long addr, unsigned char data)
> +{
> +	struct spi_transfer xfer;
> +	struct spi_message	msg;
> +	int err;
> +	unsigned long spi_data =
> +		block << 18 | addr << 10 | data;
> +
> +	stw4500->tx_buf[0] = spi_data;
> +	stw4500->rx_buf[0] = 0;
> +
> +	xfer.tx_buf	= stw4500->tx_buf;
> +	xfer.rx_buf 	= NULL;
> +	xfer.len	= sizeof(unsigned long);
> +
> +	spi_message_init(&msg);
> +	spi_message_add_tail(&xfer, &msg);
> +
> +	mutex_lock(&stw4500->lock);
you put the lock here but you update the buffer upper
so how this is supposed to protect its content?
> +	err = spi_sync(stw4500->spi, &msg);
> +	mutex_unlock(&stw4500->lock);
> +
> +	return err;
> +}
> +EXPORT_SYMBOL(stw4500_write);
> +
> +int stw4500_read(struct stw4500 *stw4500, unsigned char block,
> +		unsigned long addr)
> +{
ditto here

Best Regards,
J.

      parent reply	other threads:[~2009-10-06 21:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-23 19:49 [PATCH 6/8] [ARM] U8500: adds stw4500 as pl022 device srinidhi kasagar
2009-09-23 19:49 ` [PATCH 7/8 v2] mfd: add U8500 STw4500 SPI device support srinidhi kasagar
2009-10-01 14:13   ` Samuel Ortiz
2009-10-01 15:15     ` Samuel Ortiz
2009-10-05  4:46       ` Srinidhi KASAGAR
2009-10-06 21:08   ` Jean-Christophe PLAGNIOL-VILLARD [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=20091006210802.GA26904@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=linux-arm-kernel@lists.infradead.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).