From: bzolnier@gmail.com (Bartlomiej Zolnierkiewicz)
To: "Mark A. Greer" <mgreer@mvista.com>
Cc: Greg KH <greg@kroah.com>,
LM Sensors <sensors@stimpy.netroedge.com>,
lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH][I2C] Marvell mv64xxx i2c driver
Date: Thu, 19 May 2005 06:25:37 +0000 [thread overview]
Message-ID: <58cb370e05020817241aa42631@mail.gmail.com> (raw)
In-Reply-To: <42095A0B.2080400@mvista.com>
On Tue, 08 Feb 2005 17:32:11 -0700, Mark A. Greer <mgreer@mvista.com> wrote:
> Bartlomiej Zolnierkiewicz wrote:
>
> >Hi,
> >
> >just a minor thing
> >
> >
> >
> >>+static int __devinit
> >>+mv64xxx_i2c_init(void)
> >>+{
> >>+ return driver_register(&mv64xxx_i2c_driver);
> >>+}
> >>
> >>
> >
> >__init
> >
> >
> >
> >>+static void __devexit
> >>+mv64xxx_i2c_exit(void)
> >>+{
> >>+ driver_unregister(&mv64xxx_i2c_driver);
> >>+ return;
> >>+}
> >>
> >>
> >
> >__exit
> >
> >these functions relate to module not device
> >
>
> Gahhh. Thanks Bartlomiej.
>
> Below is yet another replacement patch
Thanks, I see that you did global replacement of __devinit
by __init and __devexit by __exit - it seems correct *only* if:
- there can be only one i2c controller in the system
- there can be only one host bridge in the system
- i2c core calls ->probe only once during driver init
and ->remove only once during driver exit
If all conditions are really true some comment about
this in the code would still be be nice.
While at it more silly, minor nitpicking ;)
> +static void
> +mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data)
> +{
> + long flags, time_left;
'flags' are of 'unsigned long' not 'long' type
> + char abort = 0;
> +
> + time_left = wait_event_interruptible_timeout(drv_data->waitq,
> + !drv_data->block, msecs_to_jiffies(drv_data->adapter.timeout));
> +
> + spin_lock_irqsave(&drv_data->lock, flags);
> + if (!time_left) { /* Timed out */
> + drv_data->rc = -ETIMEDOUT;
> + abort = 1;
> + } else if (time_left < 0) { /* Interrupted/Error */
> + drv_data->rc = time_left; /* errno value */
> + abort = 1;
> + }
> +
> + if (abort && drv_data->block) {
> + drv_data->state = MV64XXX_I2C_STATE_ABORTING;
> + spin_unlock_irqrestore(&drv_data->lock, flags);
> +
> + time_left = wait_event_timeout(drv_data->waitq,
> + !drv_data->block,
> + msecs_to_jiffies(drv_data->adapter.timeout));
> +
> + if (time_left <= 0) {
> + drv_data->state = MV64XXX_I2C_STATE_IDLE;
> + dev_err(&drv_data->adapter.dev,
> + "mv64xxx: I2C bus locked\n");
> + }
> + } else
> + spin_unlock_irqrestore(&drv_data->lock, flags);
> +
> + return;
there is no need for explicit return in void functions
[ These two comments also apply to other code in the driver. ]
Thanks,
Bartlomiej
WARNING: multiple messages have this Message-ID (diff)
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: "Mark A. Greer" <mgreer@mvista.com>
Cc: Greg KH <greg@kroah.com>,
LM Sensors <sensors@stimpy.netroedge.com>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][I2C] Marvell mv64xxx i2c driver
Date: Wed, 9 Feb 2005 02:24:19 +0100 [thread overview]
Message-ID: <58cb370e05020817241aa42631@mail.gmail.com> (raw)
In-Reply-To: <42095A0B.2080400@mvista.com>
On Tue, 08 Feb 2005 17:32:11 -0700, Mark A. Greer <mgreer@mvista.com> wrote:
> Bartlomiej Zolnierkiewicz wrote:
>
> >Hi,
> >
> >just a minor thing
> >
> >
> >
> >>+static int __devinit
> >>+mv64xxx_i2c_init(void)
> >>+{
> >>+ return driver_register(&mv64xxx_i2c_driver);
> >>+}
> >>
> >>
> >
> >__init
> >
> >
> >
> >>+static void __devexit
> >>+mv64xxx_i2c_exit(void)
> >>+{
> >>+ driver_unregister(&mv64xxx_i2c_driver);
> >>+ return;
> >>+}
> >>
> >>
> >
> >__exit
> >
> >these functions relate to module not device
> >
>
> Gahhh. Thanks Bartlomiej.
>
> Below is yet another replacement patch
Thanks, I see that you did global replacement of __devinit
by __init and __devexit by __exit - it seems correct *only* if:
- there can be only one i2c controller in the system
- there can be only one host bridge in the system
- i2c core calls ->probe only once during driver init
and ->remove only once during driver exit
If all conditions are really true some comment about
this in the code would still be be nice.
While at it more silly, minor nitpicking ;)
> +static void
> +mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data)
> +{
> + long flags, time_left;
'flags' are of 'unsigned long' not 'long' type
> + char abort = 0;
> +
> + time_left = wait_event_interruptible_timeout(drv_data->waitq,
> + !drv_data->block, msecs_to_jiffies(drv_data->adapter.timeout));
> +
> + spin_lock_irqsave(&drv_data->lock, flags);
> + if (!time_left) { /* Timed out */
> + drv_data->rc = -ETIMEDOUT;
> + abort = 1;
> + } else if (time_left < 0) { /* Interrupted/Error */
> + drv_data->rc = time_left; /* errno value */
> + abort = 1;
> + }
> +
> + if (abort && drv_data->block) {
> + drv_data->state = MV64XXX_I2C_STATE_ABORTING;
> + spin_unlock_irqrestore(&drv_data->lock, flags);
> +
> + time_left = wait_event_timeout(drv_data->waitq,
> + !drv_data->block,
> + msecs_to_jiffies(drv_data->adapter.timeout));
> +
> + if (time_left <= 0) {
> + drv_data->state = MV64XXX_I2C_STATE_IDLE;
> + dev_err(&drv_data->adapter.dev,
> + "mv64xxx: I2C bus locked\n");
> + }
> + } else
> + spin_unlock_irqrestore(&drv_data->lock, flags);
> +
> + return;
there is no need for explicit return in void functions
[ These two comments also apply to other code in the driver. ]
Thanks,
Bartlomiej
next prev parent reply other threads:[~2005-05-19 6:25 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-08 23:27 [PATCH][I2C] Marvell mv64xxx i2c driver Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-02-09 0:01 ` Bartlomiej Zolnierkiewicz
2005-05-19 6:25 ` Bartlomiej Zolnierkiewicz
2005-02-09 0:32 ` Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-02-09 1:24 ` Bartlomiej Zolnierkiewicz [this message]
2005-05-19 6:25 ` Bartlomiej Zolnierkiewicz
2005-02-09 21:33 ` Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-02-17 22:25 ` Greg KH
2005-05-19 6:25 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2005-01-26 1:29 Mark A. Greer
2005-01-26 1:26 Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-01-26 19:56 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare
2005-01-26 20:33 ` Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-01-26 21:56 ` Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-01-26 22:42 ` Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-26 23:59 ` Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-01-31 18:25 ` Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-31 18:41 ` Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-02-01 0:46 ` Greg KH
2005-05-19 6:25 ` Greg KH
2005-02-01 17:54 ` Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-05-19 6:25 ` Alexey Dobriyan
2005-02-02 1:27 ` Greg KH
2005-05-19 6:25 ` Greg KH
2005-02-02 17:26 ` Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-05-19 6:25 ` Alexey Dobriyan
2005-02-03 19:12 ` Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-02-04 0:38 ` Alexey Dobriyan
2005-05-19 6:25 ` Alexey Dobriyan
2005-02-04 0:04 ` Mark A. Greer
2005-05-19 6:25 ` Mark A. Greer
2005-02-04 9:45 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare
2005-02-06 14:36 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare
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=58cb370e05020817241aa42631@mail.gmail.com \
--to=bzolnier@gmail.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgreer@mvista.com \
--cc=sensors@stimpy.netroedge.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.