Re: [PATCH 3/3] mmc: change .get_ro() callback semantics

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Marc Pignat <marc.pignat@...>
Cc: Kumar Gala <galak@...>, David Brownell <dbrownell@...>, Pierre Ossman <drzeus-mmc@...>, Jochen Friedrich <jochen@...>, Timur Tabi <timur@...>, <linuxppc-dev@...>, <linux-kernel@...>, <spi-devel-general@...>
Date: Thursday, June 5, 2008 - 10:43 am

On Tue, Jun 03, 2008 at 12:07:49PM +0200, Marc Pignat wrote:

This isn't always practical. For example, host is using u8 register for
the status, so it might safely return u8 & mask, that will always fit
into int. Or very smart/adventurous authors might be aware that, for the
particular host, mask's bit isn't last, and safely do uXX & mask. :-)

The above is weak argument of course, since it is about optimization.

As an counter-evidence, the strict scheme that you described probably
less error prone. But is it? To implement it we'll need something like
WARN_ON(ret > 0 && ret != 1) to catch erroneous users. Take a closer
look though, will it catch uXX & lastbit case? Nope. :-)

We can catch bogus users though... via hack (_assuming_ that there
are no errno values of 1 << (sizeof(int) * 8 - 1)), i.e.
WARN_ON(ret == (1 << (sizeof(int) * 8 - 1)). Though, to do so, we don't
need the strict scheme, this debugging hack will work in the current
scheme too.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 3/3] mmc: change .get_ro() callback semantics, Anton Vorontsov, (Fri May 23, 11:43 am)
Re: [PATCH 3/3] mmc: change .get_ro() callback semantics, Anton Vorontsov, (Thu Jun 5, 10:43 am)
[PATCH] mmc: toughen get_ro() and get_cd() return values, Anton Vorontsov, (Thu Jun 5, 1:10 pm)
Re: [PATCH] mmc: toughen get_ro() and get_cd() return values, Anton Vorontsov, (Tue Jun 17, 10:16 am)
[PATCH 3/3] mmc: change .get_ro() callback semantics, Anton Vorontsov, (Tue Jun 17, 10:17 am)
[PATCH 2/3] mmc_spi: add support for card-detection polling, Anton Vorontsov, (Tue Jun 17, 10:17 am)
[PATCH 1/3] mmc: add support for card-detection polling, Anton Vorontsov, (Tue Jun 17, 10:17 am)
[PATCH 2/3] mmc_spi: add support for card-detection polling, Anton Vorontsov, (Fri May 23, 11:43 am)
[PATCH 1/3] mmc: add support for card-detection polling, Anton Vorontsov, (Fri May 23, 11:43 am)
[PATCH 3/3] mmc: change .get_ro() callback semantics, Anton Vorontsov, (Thu May 22, 2:18 pm)
[PATCH 2/3] mmc_spi: add support for card-detection polling, Anton Vorontsov, (Thu May 22, 2:18 pm)
[PATCH 1/3] mmc: add support for card-detection polling, Anton Vorontsov, (Thu May 22, 2:18 pm)
[PATCH 2/2] mmc_spi: add support for card-detection polling, Anton Vorontsov, (Wed May 21, 2:47 pm)
[PATCH 1/2] mmc: add support for card-detection polling, Anton Vorontsov, (Wed May 21, 2:47 pm)