Re: [PATCH] IIO:sysfs.h: Use static declaration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 
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.



> 
> 
> Index: drivers/staging/iio/sysfs.h
> ===================================================================
> --- drivers/staging/iio/sysfs.h (revision 8430)
> +++ drivers/staging/iio/sysfs.h (working copy)
> @@ -95,16 +95,16 @@
>                         .val2 = _val2 }
> 
>  #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         \
>         = IIO_ATTR(_name, _mode, _show, _store, _addr)
> 
> 
>  #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                 \
>         = IIO_ATTR_2(_name, _mode, _show, _store, _addr, _val2)
> 
>  #define IIO_CONST_ATTR(_name, _string)                                 \
> -       struct iio_const_attr iio_const_attr_##_name                    \
> +       static struct iio_const_attr iio_const_attr_##_name                     \
>         = { .string = _string,                                          \
>             .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
> 
> 
> ------------------------------------------------------------------
> ********* Analog Devices GmbH              Open Platform Solutions
> **  *****
> **     ** Wilhelm-Wagenfeld-Strasse 6
> **  ***** D-80807 Munich
> ********* Germany
> Registergericht München HRB 40368,  Geschäftsführer: Thomas Wessel, William A. Martin, Margaret K. Seif
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux