mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <guenter.roeck@ericsson.com>
To: Alex Rio <scasbyte@gmail.com>
Cc: "khali@linux-fr.org" <khali@linux-fr.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH 2/2] hwmon: (w83627ehf) Add GPIO port 3 functionality
Date: Sat, 14 Jan 2012 09:54:47 -0800	[thread overview]
Message-ID: <20120114175447.GF29012@ericsson.com> (raw)
In-Reply-To: <CAPbJ=B=_Xubsni7R00kSotDQ9AE9jmhmyRV0gPkXGqAPGrNaXg@mail.gmail.com>

Alex,

On Fri, Jan 13, 2012 at 08:39:56PM -0500, Alex Rio wrote:
> The w83627ehf chip has 5 GPIO ports, currently none of them is supported.
> This patch adds the GPIO port 3 driver with the following functions:
> set/get pin values, direction_in/out, set_debounce.
> The values are also available to the userspace (if requiered)
> in the path /sys/class/gpio by using the export/unexport functions.
> Please look at the REVISIT comment, this is the main reason of the RFC,
> suggestions will be highly appreciated.
> 
> Signed-off-by: Alex Rio <scasbyte@gmail.com>
> ---

[ ... ]

> +/* REVISIT!: This is a global variable for sioreg.
> + * How could a function like gpio_get be able to access
> + * sioreg from w83627ehf_sio_data?
> + * Maybe we can make the sioreg global?
> + */
> +int global_sioaddr;
> +

This is a complete no-go, even more so since the variable name is very generic
and visible in the entire kernel. Define the variables you need as part of
a structure for which you get a pointer to, then use container_of()
to get the pointer to the outer data structure. Other gpio drivers
do this already; just look there for examples.

Guenter

  reply	other threads:[~2012-01-14 17:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-14  1:39 Alex Rio
2012-01-14 17:54 ` Guenter Roeck [this message]
2012-01-14 20:18 ` Jean Delvare
2012-01-14 22:15   ` Alejandro
2012-01-15  8:15     ` Jean Delvare
2012-01-15 10:53     ` Rodolfo Giometti
2012-01-16  9:42       ` Alejandro del Rio
2012-01-16 16:18         ` Guenter Roeck

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=20120114175447.GF29012@ericsson.com \
    --to=guenter.roeck@ericsson.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scasbyte@gmail.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

Powered by JetHome