lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 15 Oct 2012 13:36:30 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	"Shevchenko, Andriy" <andriy.shevchenko@...el.com>
Cc:	"rob.herring@...xeda.com" <rob.herring@...xeda.com>,
	"grant.likely@...retlab.ca" <grant.likely@...retlab.ca>,
	"spear-devel@...t.st.com" <spear-devel@...t.st.com>,
	"devicetree-discuss@...ts.ozlabs.org" 
	<devicetree-discuss@...ts.ozlabs.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

On 15 October 2012 13:26, Shevchenko, Andriy
<andriy.shevchenko@...el.com> wrote:
> On Fri, 2012-10-12 at 23:31 +0530, Viresh Kumar wrote:

>> +     while (_sz--)                                                   \
>> +             *_out++ = (_type)be32_to_cpup(_val++);                  \
> How about
> *_out++ = (typeof(*_out))...
> ?

:)


diff --git a/drivers/of/base.c b/drivers/of/base.c
index c5a09c2..039e178 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -670,7 +670,7 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 }
 EXPORT_SYMBOL(of_find_node_by_phandle);

-#define of_property_read_array(_np, _pname, _out, _sz, _type)          \
+#define of_property_read_array(_np, _pname, _out, _sz)                 \
        struct property *_prop = of_find_property(_np, _pname, NULL);   \
        const __be32 *_val;                                             \
                                                                        \
@@ -683,7 +683,7 @@ EXPORT_SYMBOL(of_find_node_by_phandle);
                                                                        \
        _val = _prop->value;                                            \
        while (_sz--)                                                   \
-               *_out++ = (_type)be32_to_cpup(_val++);                  \
+               *_out++ = (typeof(*_out))be32_to_cpup(_val++);          \
        return 0;

 /**
@@ -703,7 +703,7 @@ EXPORT_SYMBOL(of_find_node_by_phandle);
 int of_property_read_u8_array(const struct device_node *np,
                        const char *propname, u8 *out_values, size_t sz)
 {
-       of_property_read_array(np, propname, out_values, sz, u8);
+       of_property_read_array(np, propname, out_values, sz);
 }
 EXPORT_SYMBOL_GPL(of_property_read_u8_array);

@@ -724,7 +724,7 @@ EXPORT_SYMBOL_GPL(of_property_read_u8_array);
 int of_property_read_u16_array(const struct device_node *np,
                        const char *propname, u16 *out_values, size_t sz)
 {
-       of_property_read_array(np, propname, out_values, sz, u16);
+       of_property_read_array(np, propname, out_values, sz);
 }
 EXPORT_SYMBOL_GPL(of_property_read_u16_array);

@@ -747,7 +747,7 @@ int of_property_read_u32_array(const struct device_node *np,
                               const char *propname, u32 *out_values,
                               size_t sz)
 {
-       of_property_read_array(np, propname, out_values, sz, u32);
+       of_property_read_array(np, propname, out_values, sz);
 }
 EXPORT_SYMBOL_GPL(of_property_read_u32_array);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ