Re: [PATCH] leds: pm8058: Make ledtype pointer sized type

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

 



On 11/30/2017 10:40 AM, Pavel Machek wrote:
> On Wed 2017-11-29 19:05:43, Bjorn Andersson wrote:
>> The pointer returned by of_device_get_match_data() doesn't have the same
>> size as u32 on 64-bit architectures, causing issues when compile testing
>> the driver on such platform. Make ledtype unsigned long instead, to
>> solve this problem.
>>
>> Fixes: 7f866986e705 ("leds: add PM8058 LEDs driver")
>> Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
>> Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
> 
> Ummm... no?
> 
> extern const void *of_device_get_match_data(const struct device *dev);
> 
> 
>> diff --git a/drivers/leds/leds-pm8058.c b/drivers/leds/leds-pm8058.c
>> index a52674327857..cc2afe81720d 100644
>> --- a/drivers/leds/leds-pm8058.c
>> +++ b/drivers/leds/leds-pm8058.c
>> @@ -29,7 +29,7 @@
>>  struct pm8058_led {
>>  	struct regmap *map;
>>  	u32 reg;
>> -	u32 ledtype;
>> +	unsigned long ledtype;
> 
> Make it void *. u32 is buggy. unsigned long is merely ugly code. void
> * is not nice, but certainly better than unsigned long.

unsigned long is correct, see below:

static const struct of_device_id pm8058_leds_id_table[] = {
        {
                .compatible = "qcom,pm8058-led",
                .data = (void *)PM8058_LED_TYPE_COMMON
        },
        {
                .compatible = "qcom,pm8058-keypad-led",
                .data = (void *)PM8058_LED_TYPE_KEYPAD
        },
        {
                .compatible = "qcom,pm8058-flash-led",
                .data = (void *)PM8058_LED_TYPE_FLASH
        },
        { },
};

of_device_get_match_data will return PM8058_LED_TYPE_*
which clearly is a led type identifier.

Thus unsigned long looks reasonable.

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



[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux