linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Valentin <edubezval@gmail.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: rui.zhang@intel.com, kevin.wangtao@linaro.org,
	leo.yan@linaro.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH V2 3/4] thermal/drivers/hisi: Prepare to add support for other hisi platforms
Date: Sat, 21 Oct 2017 09:42:57 -0700	[thread overview]
Message-ID: <20171021164256.GA30342@localhost.localdomain> (raw)
In-Reply-To: <c202f396-fdc3-70cd-d762-71c088e04ba0@linaro.org>

On Sat, Oct 21, 2017 at 10:14:33AM +0200, Daniel Lezcano wrote:
> On 20/10/2017 22:58, Eduardo Valentin wrote:
> > On Fri, Oct 20, 2017 at 05:11:06PM +0200, Daniel Lezcano wrote:
> >> From: Kevin Wangtao <kevin.wangtao@linaro.org>
> >>
> >> For platform compatibility, add the tsensor ops to a thermal data
> >> structure. Each platform has its own probe function to register proper
> >> tsensor ops function to the pointer, platform related resource request
> >> are also implemented in the platform probe function.
> >>
> >> Signed-off-by: Kevin Wangtao <kevin.wangtao@linaro.org>
> >> Tested-by: Daniel Lezcano <daniel.lezcano@linaro.org> # hikey6220
> >> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> > 
> > This patch adds this issue to hisi driver (sparse)
> > 
> > drivers/thermal/hisi_thermal.c:398:24: warning: incorrect type in assignment (different modifiers)
> > drivers/thermal/hisi_thermal.c:398:24:    expected int ( *platform_probe )( ... )
> > drivers/thermal/hisi_thermal.c:398:24:    got void const *
> > 
> > essentially you are casting a const into a non const.
> > 
> > Please fix and resend.
> 
> I was not able to reproduce the warning. I tried the C=1, C=2 options,
> cross compiled or compiled on x86 with COMPILE_TEST, the warning does
> not appear.
> 
> Are you using make C=1 or something else to run sparse on the kernel
> sources ?


Yes, this is a make C=1.

The warning is in this code that you add in this patch:
+       platform_probe = of_device_get_match_data(dev);
+       if (!platform_probe) {
+               dev_err(dev, "failed to get probe func\n");
+               return -EINVAL;
        }

platform_probe should be const, because of_device_get_match_data() returns a const:

$ grep -A 10 of_device_get_match_data drivers/of/device.c 
const void *of_device_get_match_data(const struct device *dev)
{
	const struct of_device_id *match;

	match = of_match_device(dev->driver->of_match_table, dev);
	if (!match)
		return NULL;

	return match->data;
}
EXPORT_SYMBOL(of_device_get_match_data);


which I agree, you should use a const to receive the of_device_get_match_data().

> 
> 
> 
> -- 
>  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
> 
> Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog
> 

  reply	other threads:[~2017-10-21 16:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 15:11 [PATCH V2 0/4] thermal/drivers/hisi: Add hi3660 thermal driver support Daniel Lezcano
2017-10-20 15:11 ` [PATCH V2 1/4] thermal/drivers/hisi: Put platform code together Daniel Lezcano
2017-10-20 15:11 ` [PATCH V2 2/4] thermal/drivers/hisi: Add platform prefix to function name Daniel Lezcano
2017-10-20 15:11 ` [PATCH V2 3/4] thermal/drivers/hisi: Prepare to add support for other hisi platforms Daniel Lezcano
2017-10-20 20:58   ` Eduardo Valentin
2017-10-21  8:14     ` Daniel Lezcano
2017-10-21 16:42       ` Eduardo Valentin [this message]
     [not found]         ` <CAKnoXLzieT2RwaVr9_Oj6nxsX+CSd_o=uJjxWbdg28p783e72w@mail.gmail.com>
2017-10-21 19:08           ` Eduardo Valentin
2017-10-21 19:58             ` Daniel Lezcano
2017-10-22  8:55             ` Daniel Lezcano
2017-10-20 15:11 ` [PATCH V2 4/4] thermal/drivers/hisi: Add support for hi3660 SoC Daniel Lezcano

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=20171021164256.GA30342@localhost.localdomain \
    --to=edubezval@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=kevin.wangtao@linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.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 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).