LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor@insightbb.com>
To: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Cc: linux-input@atrey.karlin.mff.cuni.cz,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Add Cobalt button interface driver support
Date: Thu, 15 Feb 2007 23:09:43 -0500	[thread overview]
Message-ID: <200702152309.44563.dtor@insightbb.com> (raw)
In-Reply-To: <20070216123608.733f04a3.yoichi_yuasa@tripeaks.co.jp>

On Thursday 15 February 2007 22:36, Yoichi Yuasa wrote:
> Hi,
> 
> This patch adds support for the back panel buttons on Cobalt server.
> It's tested on the Cobalt Qube2.
> 

Hi,

Thank you for your patch. Couple of comments:

> +
> +		button++;
> +	}
> +
> +	mod_timer(&buttons_timer, jiffies + HZ / BUTTONS_POLL_FREQUENCY);

May I suggest using msecs_to_jiffies() to avoid direct computations on HZ?

> +
> +	bdev->input = input;
> +	bdev->reg = ioremap(res->start, res->end - res->start + 1);
> +	dev_set_drvdata(&pdev->dev, bdev);
> +
> +	setup_timer(&buttons_timer, handle_buttons, (unsigned long)bdev);
> +	mod_timer(&buttons_timer, jiffies + HZ / BUTTONS_POLL_FREQUENCY);

Please implement cobalt_buttons_open() and cobalt_buttons_close() methods
and start/stop timer from there - there is no point in polling hardware
if noone is listening to the events.

> +
> +	return retval;
> +}
> +
> +static int __devexit cobalt_buttons_remove(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct buttons_dev *bdev = dev_get_drvdata(dev);
> +
> +	del_timer(&buttons_timer);

del_timer_sync? Is there any possibility it may run SMP?

> +
> +static void __exit cobalt_buttons_exit(void)
> +{
> +	platform_driver_unregister(&cobalt_buttons_driver);

You are not allowed to unregister statically allocated devices -
if there are references left and your module goes away then
these references become invalid and kernel goes boom.

Please convert to platform_device_alloc/platform_device_add.

Is there a point of moving platform device creation code into
platform-specific code? Is there a possibility of this driver
being used elsewhere?

> +	platform_device_unregister(&cobalt_buttons_device);
> +}
> +
> +module_init(cobalt_buttons_init);
> +module_exit(cobalt_buttons_exit);
> 

-- 
Dmitry

  reply	other threads:[~2007-02-16  4:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16  3:36 Yoichi Yuasa
2007-02-16  4:09 ` Dmitry Torokhov [this message]
2007-02-16  8:15   ` Yoichi Yuasa
2007-02-16 15:15     ` Dmitry Torokhov
2007-02-16 16:22       ` Yoichi Yuasa
2007-04-04  4:01         ` Dmitry Torokhov
2007-04-05  5:02           ` Yoichi Yuasa

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=200702152309.44563.dtor@insightbb.com \
    --to=dtor@insightbb.com \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yoichi_yuasa@tripeaks.co.jp \
    --subject='Re: [PATCH] Add Cobalt button interface driver support' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).