On Wed, Nov 25, 2009 at 11:47 PM, Magnus Damm <[email protected]> wrote: > Hi Grant, > > On Thu, Nov 26, 2009 at 7:15 AM, Grant Likely <[email protected]> > wrote: >> On Wed, Nov 25, 2009 at 1:26 AM, Magnus Damm <[email protected]> wrote: >>> /* per-word shift register access, in hardware or bitbanging */ >>> - cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)]; >>> - if (!cs->txrx_word) >>> - return -EINVAL; >>> + if (bitbang->txrx_bufs == spi_bitbang_bufs) { >>> + cs->txrx_word = bitbang->txrx_word[spi->mode & mode_mask]; >>> + if (!cs->txrx_word) >>> + return -EINVAL; >>> + } >> >> Hmmm... this smells like an ugly hack to me. It seems to me that if >> some bitbang backend drivers don't want this code, then it should be >> encoded into a callback so it can be overridden. Thoughts. > > Yeah, it's far from clean. I want to make use of spi_bitbang_setup() > in my MSIOF driver, but I want to avoid dummy txtx_word[] callbacks > that will be unused since i'm using a driver specific > bitbang->txrx_bufs function. > > I guess the attached patch is slightly cleaner? I like the idea of > letting bitbang drivers use shared code for > spi_bitbang_setup()/spi_bitbang_cleanup() with their private > setup_transfer() function which in turn calls > spi_bitbang_setup_transfer(). My impression is that there's quite a > bit of duplicated setup()/cleanup() code.
This is certainly less ugly. But with the points brought up in the other thread, I want to have a close look at spi-bitbang before I start applying stuff. It seems nasty. Give me a few days. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ spi-devel-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spi-devel-general
