linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: "Hennerich, Michael" <Michael.Hennerich@analog.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"uclinux-dist-devel@blackfin.uclinux.org"
	<uclinux-dist-devel@blackfin.uclinux.org>
Subject: Re: [PATCH] IIO:sysfs.h: Use static declaration
Date: Tue, 09 Mar 2010 15:29:38 +0000	[thread overview]
Message-ID: <4B966962.7010104@cam.ac.uk> (raw)
In-Reply-To: <544AC56F16B56944AEC3BD4E3D5917712D6B1D97D2@LIMKCMBX1.ad.analog.com>

On 03/09/10 15:13, Hennerich, Michael wrote:
> Shouldn't those be better declared 'static'?

No. Convention is to do that when calling the macro as then=20
it is explicit in the relevant place.  Now if any of the calls
are missing the static keyword, that would be an error.

I've cheated a bit on the event equivalent as they define a pair
of structures.  Keep meaning to ask on how to do things like that
properly (don't suppose anyone knows?)

On another note, I'm getting increasingly tempted to drop the device
specific headers and move over to a more hwmon like fix naming at
review.  With new api they are huge and sometimes actually add code
rather than saving it.  Not that it effects these particularly macros.



>=20
>=20
> Index: drivers/staging/iio/sysfs.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- drivers/staging/iio/sysfs.h (revision 8430)
> +++ drivers/staging/iio/sysfs.h (working copy)
> @@ -95,16 +95,16 @@
>                         .val2 =3D _val2 }
>=20
>  #define IIO_DEVICE_ATTR(_name, _mode, _show, _store, _addr)    \
> -       struct iio_dev_attr iio_dev_attr_##_name                \
> +       static struct iio_dev_attr iio_dev_attr_##_name         \
>         =3D IIO_ATTR(_name, _mode, _show, _store, _addr)
>=20
>=20
>  #define IIO_DEVICE_ATTR_2(_name, _mode, _show, _store, _addr, _val2)=
   \
> -       struct iio_dev_attr iio_dev_attr_##_name                     =
   \
> +       static struct iio_dev_attr iio_dev_attr_##_name              =
   \
>         =3D IIO_ATTR_2(_name, _mode, _show, _store, _addr, _val2)
>=20
>  #define IIO_CONST_ATTR(_name, _string)                              =
   \
> -       struct iio_const_attr iio_const_attr_##_name                 =
   \
> +       static struct iio_const_attr iio_const_attr_##_name          =
           \
>         =3D { .string =3D _string,                                   =
       \
>             .dev_attr =3D __ATTR(_name, S_IRUGO, iio_read_const_attr,=
 NULL)}
>=20
>=20
> ------------------------------------------------------------------
> ********* Analog Devices GmbH              Open Platform Solutions
> **  *****
> **     ** Wilhelm-Wagenfeld-Strasse 6
> **  ***** D-80807 Munich
> ********* Germany
> Registergericht M=FCnchen HRB 40368,  Gesch=E4ftsf=FChrer: Thomas Wes=
sel, William A. Martin, Margaret K. Seif
>=20
>=20


  reply	other threads:[~2010-03-09 15:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-09 15:13 [PATCH] IIO:sysfs.h: Use static declaration Hennerich, Michael
2010-03-09 15:29 ` Jonathan Cameron [this message]
2010-03-09 15:39   ` Hennerich, Michael
2010-03-09 15:46     ` Jonathan Cameron

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=4B966962.7010104@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=Michael.Hennerich@analog.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=uclinux-dist-devel@blackfin.uclinux.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;
as well as URLs for NNTP newsgroup(s).