lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fa686aa40911260645i50bf0c35g93b4146952a5f82e@mail.gmail.com>
Date:	Thu, 26 Nov 2009 07:45:51 -0700
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Magnus Damm <magnus.damm@...il.com>
Cc:	spi-devel-general@...ts.sourceforge.net,
	dbrownell@...rs.sourceforge.net, linux-kernel@...r.kernel.org,
	akpm@...ux-foundation.org
Subject: Re: [PATCH] spi: Allow using spi_bitbang_setup() with custom 
	txrx_bufs()

On Thu, Nov 26, 2009 at 12:50 AM, Magnus Damm <magnus.damm@...il.com> wrote:
> On Thu, Nov 26, 2009 at 4:21 PM, Grant Likely <grant.likely@...retlab.ca> wrote:
>> On Wed, Nov 25, 2009 at 11:47 PM, Magnus Damm <magnus.damm@...il.com> wrote:
>>> On Thu, Nov 26, 2009 at 7:15 AM, Grant Likely <grant.likely@...retlab.ca> wrote:
>>>> On Wed, Nov 25, 2009 at 1:26 AM, Magnus Damm <magnus.damm@...il.com> 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.
>
> Sure, I plan on posting a V2 of the MSIOF driver. I plan to keep the
> dummy txrx_word() function for now - this to disconnect the cleanup
> from the driver integration, hope that sounds like a good plan.

Works for me.  Now I just need to find someone with the time to
refactor spi-bitbang.  :-)

g.




-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ