public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Sokolovsky <pmiscml@gmail.com>
To: Juergen Schindele <schindele@nentec.de>
Cc: linux-arm-kernel@lists.arm.linux.org.uk, linux-kernel@vger.kernel.org
Subject: Re: [RFC, PATCH 1/3] gpiodev - API definitions
Date: Thu, 12 Apr 2007 17:31:16 +0300	[thread overview]
Message-ID: <1177494873.20070412173116@gmail.com> (raw)
In-Reply-To: <200704110847.01107.schindele@nentec.de>

Hello Juergen,

Wednesday, April 11, 2007, 9:47:01 AM, you wrote:

> Am Dienstag, 10. April 2007 23:30 schrieb Paul Sokolovsky:
>> Hello linux-arm-kernel,
>>
>> GPIODEV API: Core API definitions. Provided are:
>> 1. struct gpiodev_ops which must be included into platform_data structure
>> of a device which will provide GPIODEV API; driver for a device must
>> initialize this structure.
>> 2. Structural definition of generalized GPIO identifier (struct gpio).
>> 2. Set of API calls for clients. This fully follow Generic GPIO API
>> naming and semantics, except that they have "gpiodev" prefix and
>> accept struct gpio instead of integer gpio identifiers.
>>
>>
[]
>> +/* API functions */
>> +
>> +static inline int gpiodev_get_value(struct gpio *gpio)
>> +{
>> +       struct gpiodev_ops *ops = gpio->gpio_dev->dev.platform_data;

> wouldn't it be more sure to verify if xxx function is NOT null
> before using it ?? Perhaps something like that
>              BUG_ON(!ops->get);

  GPIODEV is considered to be low-level one and critical for speed, so
all method pointers assumed to be set properly. In particular, if some
operation is not available for a device (say, GPI/GPO case), a method
must be set to a stab function.

  BUG_ON would be acceptable, as it can be compiled out based on
CONFIG setting, but as was pointed out, doesn't add much into picture
anyway.

  But I'd be happy to add comment to struct gpiodev_ops declaration
about the described method constraints, thanks for comment.

[]


-- 
Best regards,
 Paul                            mailto:pmiscml@gmail.com


      parent reply	other threads:[~2007-04-12 14:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-10 21:30 [RFC, PATCH 1/3] gpiodev - API definitions Paul Sokolovsky
2007-04-11  0:30 ` Eric Miao
2007-04-11  2:11   ` Paul Sokolovsky
2007-04-11  6:47 ` Juergen Schindele
2007-04-11  7:42   ` Russell King
2007-04-12 14:31   ` Paul Sokolovsky [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=1177494873.20070412173116@gmail.com \
    --to=pmiscml@gmail.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schindele@nentec.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox