linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Corentin Chary <corentin.chary@gmail.com>
To: Yong Wang <yong.y.wang@linux.intel.com>
Cc: Matthew Garrett <mjg@redhat.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Richard Purdie <rpurdie@linux.intel.com>,
	platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH] eeepc-wmi: Add backlight support
Date: Thu, 8 Apr 2010 07:29:59 +0200	[thread overview]
Message-ID: <p2y71cd59b01004072229wb66497a4q77d647bdcce49e9d@mail.gmail.com> (raw)
In-Reply-To: <20100407225005.GA30445@ywang-moblin2.bj.intel.com>

On Thu, Apr 8, 2010 at 12:50 AM, Yong Wang <yong.y.wang@linux.intel.com> wrote:
> On Wed, Apr 07, 2010 at 05:05:41PM +0200, Corentin Chary wrote:
>> On Wed, Apr 7, 2010 at 4:17 PM, Yong Wang <yong.y.wang@linux.intel.com> wrote:
>> > Add backlight support for WMI based Eee PC laptops. In addition, start
>> > to use a platform device to manage all functional devices as more
>> > features will be implemented later.
>> >
>> > +static struct platform_device *eeepc_wmi_platform_device;
>> > ?static struct input_dev *eeepc_wmi_input_dev;
>> > +struct backlight_device *eeepc_wmi_backlight_device;
>>
>> Instead of using static variables, you should really use a struct
>> eeepc_wmi, store stuff inside it,
>> and make all these functions reentrant. Alan did it for eeepc-laptop,
>> and I did it for asus-laptop,
>> see http://git.iksaif.net/?p=acpi4asus.git;a=commit;h=854c78363f37f03e30e2856ef17d7eefc62e0d06
>> .
>> The driver would really be cleaner and easier to review with that. And
>> it would be more coherent with
>> eeepc-laptop's code.
>>
>
> Thanks for your review, Corentin. Could you please explain a bit more
> what you mean by "make all these functions reentrant"?
>
> Thanks
> -Yong
>
>

Well, it means that you should'nt use a static variable for platform,
backlight, input
and only use function parameters to get the job done.
In your case, it's not really mandatory, but as Alan explain in the
changelog I linked,
it's really cleaner. And also make the code a lot easier to review.

Also, if you do that, could you split up the patch in (for example):
- add a eeepc_wmi context structure, and put input_device into it
- add a platform device
- add backlight support

Thanks !

-- 
Corentin Chary
http://xf.iksaif.net

      reply	other threads:[~2010-04-08  5:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07 14:17 [PATCH] eeepc-wmi: Add backlight support Yong Wang
2010-04-07 15:05 ` Corentin Chary
2010-04-07 22:50   ` Yong Wang
2010-04-08  5:29     ` Corentin Chary [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=p2y71cd59b01004072229wb66497a4q77d647bdcce49e9d@mail.gmail.com \
    --to=corentin.chary@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rpurdie@linux.intel.com \
    --cc=yong.y.wang@linux.intel.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 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).