From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>,
Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: stewart@linux.vnet.ibm.com, arnd@arndb.de,
j.anaszewski81@gmail.com, cooloney@gmail.com, rpurdie@rpsys.net,
linuxppc-dev@lists.ozlabs.org, linux-leds@vger.kernel.org,
khandual@linux.vnet.ibm.com
Subject: Re: [PATCH v5 3/3] leds/powernv: Add driver for PowerNV platform
Date: Fri, 17 Jul 2015 11:23:37 +0530 [thread overview]
Message-ID: <55A89861.8000505@linux.vnet.ibm.com> (raw)
In-Reply-To: <1437036428.15828.1.camel@ellerman.id.au>
On 07/16/2015 02:17 PM, Michael Ellerman wrote:
> On Thu, 2015-07-16 at 10:27 +0200, Jacek Anaszewski wrote:
>> On 07/16/2015 08:54 AM, Vasant Hegde wrote:
>>>>> +static enum led_brightness powernv_led_get(struct led_classdev *led_cdev)
>>>>> +{
>>>>> + char *loc_code;
>>>>> + int rc, led_type;
>>>>> + __be64 led_mask, led_value, max_led_type;
>>>>> +
>>>>> + led_type = powernv_get_led_type(led_cdev);
>>>>> + if (led_type == -1)
>>>>> + return LED_OFF;
>>>>> +
>>>>> + loc_code = powernv_get_location_code(led_cdev);
>>>>> + if (!loc_code)
>>>>> + return LED_OFF;
>>>>> +
>>>>> + /* Fetch all LED status */
>>>>> + led_mask = cpu_to_be64(0);
>>>>> + led_value = cpu_to_be64(0);
>>>>> + max_led_type = cpu_to_be64(OPAL_SLOT_LED_TYPE_MAX);
>>>>> +
>>>>> + rc = opal_leds_get_ind(loc_code, &led_mask, &led_value, &max_led_type);
>>>>> + if (rc != OPAL_SUCCESS && rc != OPAL_PARTIAL) {
>>>>> + dev_err(led_cdev->dev,
>>>>> + "%s: OPAL get led call failed [rc=%d]\n",
>>>>> + __func__, rc);
>>>>> + goto led_fail;
>>>>> + }
>>>>> +
>>>>> + led_mask = be64_to_cpu(led_mask);
>>>>> + led_value = be64_to_cpu(led_value);
>>>>
>>>> be64_to_cpu result should be assigned to the variable of u64/s64 type.
>>>
>>> PowerNV platform is capable of running both big/little endian mode.. But
>>> presently our firmware is big endian. These variable contains big endian values.
>>> Hence I have created as __be64 .. (This is the convention we follow in other
>>> places as well).
>>
>> It is correct that the argument is of __be64 type, but be64_to_cpu
>> returns u64 type, whereas you assign it to __be64.
>
> Yeah that's wrong. You are using led_mask etc as __be64 when you pass them to
> firmware, which is correct, but then you're also using them as the lvalue of
> be64_to_cpu() which returns a u64.
>
Yep. Got it.
> Sparse should warn you about that if you use it, please do.
>
> $ apt-get install sparse
> $ cd kernel
> $ make C=2 CF=-D__CHECK_ENDIAN__
>
Thanks!
-Vasant
next prev parent reply other threads:[~2015-07-17 5:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-01 8:50 [PATCH v5 0/3] LED driver for PowerNV platform Vasant Hegde
2015-07-01 8:50 ` [PATCH v5 1/3] powerpc/powernv: Add OPAL interfaces for accessing and modifying system LED states Vasant Hegde
2015-07-01 8:50 ` [PATCH v5 2/3] powerpc/powernv: Create LED platform device Vasant Hegde
2015-07-01 8:50 ` [PATCH v5 3/3] leds/powernv: Add driver for PowerNV platform Vasant Hegde
2015-07-14 9:00 ` Jacek Anaszewski
2015-07-16 6:54 ` Vasant Hegde
2015-07-16 6:54 ` Vasant Hegde
2015-07-16 8:27 ` Jacek Anaszewski
2015-07-16 8:47 ` Michael Ellerman
2015-07-17 5:53 ` Vasant Hegde [this message]
2015-07-17 5:52 ` Vasant Hegde
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=55A89861.8000505@linux.vnet.ibm.com \
--to=hegdevasant@linux.vnet.ibm.com \
--cc=arnd@arndb.de \
--cc=cooloney@gmail.com \
--cc=j.anaszewski81@gmail.com \
--cc=j.anaszewski@samsung.com \
--cc=khandual@linux.vnet.ibm.com \
--cc=linux-leds@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=rpurdie@rpsys.net \
--cc=stewart@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.