public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
Cc: Grant Likely
	<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org,
	i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: Re: [PATCH] of/i2c: don't pass -1 to irq_dispose_mapping, otherwise kernel will oops
Date: Sat, 12 Jul 2008 10:22:59 +0200	[thread overview]
Message-ID: <20080712082259.GA16810@pengutronix.de> (raw)
In-Reply-To: <20080711191502.GA21847-PHTr8nzUCjejyJ0x5qLZdcN33GVbZNy3@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 1062 bytes --]

On Fri, Jul 11, 2008 at 11:15:02PM +0400, Anton Vorontsov wrote:

> > Nope, it was a bug in the i2c documentation fixed recently:
> 
> Nope? I'm looking into i2c-core.c:
> 
> .. i2c_new_device(...)
> {
> 	client->irq = info->irq;
> 
> Core will blindly pass irq, so clients should ensure that irq contains
> correct value. And as far as there is no common scheme of checking that
> "there is no irq specified", the most safe option is -1.

I wonder if -1 is really the safest; even kernel functions related to
irqs are not consistent if "irq" is int or unsigned int. So, -1 could
cause subtle signedness defects.

The whole "no irq" mess really needs to be cleared generally. It just
disturbed me that i2c_core was imposing -1, whilst some other subsystem
may have chosen 0. IMHO, subsystems like i2c should pass irqs
transparently. This is why I submitted the patch for i2c documentation.

All the best,

   Wolfram

-- 
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

  parent reply	other threads:[~2008-07-12  8:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080711174859.GA24260@polina.dev.rtsoft.ru>
2008-07-11 18:23 ` [PATCH] of/i2c: don't pass -1 to irq_dispose_mapping, otherwise kernel will oops Grant Likely
2008-07-11 18:55   ` Anton Vorontsov
     [not found]   ` <20080711182323.GB15321-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
2008-07-11 19:01     ` Jochen Friedrich
2008-07-11 19:15       ` Anton Vorontsov
     [not found]         ` <20080711191502.GA21847-PHTr8nzUCjejyJ0x5qLZdcN33GVbZNy3@public.gmane.org>
2008-07-12  8:22           ` Wolfram Sang [this message]
2008-07-12  8:00   ` [i2c] " Wolfram Sang
2008-07-13  3:59     ` Jon Smirl
     [not found]     ` <20080712080004.GA16739-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-07-16 22:20       ` Grant Likely

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=20080712082259.GA16810@pengutronix.de \
    --to=w.sang-bicnvbalz9megne8c9+irq@public.gmane.org \
    --cc=avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
    --cc=linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.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