Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: d-gerlach@ti.com (Dave Gerlach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] cpufreq: ti-cpufreq: Only register platform_device when supported
Date: Tue, 13 Nov 2018 13:14:15 -0600	[thread overview]
Message-ID: <c93fb7a9-88ad-d634-18ff-088d146637ce@ti.com> (raw)
In-Reply-To: <20181113175853.GN13311@localhost>

On 11/13/2018 11:58 AM, Johan Hovold wrote:
> On Tue, Nov 13, 2018 at 11:39:12AM -0600, Dave Gerlach wrote:
>> Currently the ti-cpufreq driver blindly registers a 'ti-cpufreq' to force
>> the driver to probe on any platforms where the driver is built in.
>> However, this should only happen on platforms that actually can make use
>> of the driver. There is already functionality in place to match the
>> SoC compatible so let's factor this out into a separate call and
>> make sure we find a match before creating the ti-cpufreq platform device.
>>
>> Reviewed-by: Johan Hovold <johan@kernel.org>
>> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
>> ---
>> v2->v3: Use platform_device_register_resndata to pass match data to probe to
>> 	to avoid matching again in probe.
>>
>> 	v2: https://patchwork.kernel.org/patch/10574535/
>>
> 
>>  static int ti_cpufreq_init(void)
>>  {
>> -	platform_device_register_simple("ti-cpufreq", -1, NULL, 0);
>> +	const struct of_device_id *match;
>> +
>> +	/* Check to ensure we are on a compatible platform */
>> +	match = ti_cpufreq_match_node();
>> +	if (match)
>> +		platform_device_register_resndata(NULL, "ti-cpufreq", -1, NULL,
>> +						  0, match,
>> +						  sizeof(*match));
> 
> platform_device_register_data()?

Whoops yeah that's a bit more concise, v4 incoming.

Regards,
Dave

> 
>>  	return 0;
>>  }
>>  module_init(ti_cpufreq_init);
> 
> Johan
> 

      reply	other threads:[~2018-11-13 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13 17:39 [PATCH v3] cpufreq: ti-cpufreq: Only register platform_device when supported Dave Gerlach
2018-11-13 17:58 ` Johan Hovold
2018-11-13 19:14   ` Dave Gerlach [this message]

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=c93fb7a9-88ad-d634-18ff-088d146637ce@ti.com \
    --to=d-gerlach@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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