<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/base/platform.c, branch v4.4.22</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.4.22</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.4.22'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2016-02-17T20:30:55+00:00</updated>
<entry>
<title>base/platform: Fix platform drivers with no probe callback</title>
<updated>2016-02-17T20:30:55+00:00</updated>
<author>
<name>Martin Wilck</name>
<email>Martin.Wilck@ts.fujitsu.com</email>
</author>
<published>2015-11-30T11:50:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9e5d4a6c799565346b677484f7348effd6f2d877'/>
<id>urn:sha1:9e5d4a6c799565346b677484f7348effd6f2d877</id>
<content type='text'>
commit 25cad69f21f5532d99e2ee73c8ab6512bcab614c upstream.

Since b8b2c7d845d5, platform_drv_probe() is called for all platform
devices. If drv-&gt;probe is NULL, and dev_pm_domain_attach() fails,
platform_drv_probe() will return the error code from dev_pm_domain_attach().

This causes real_probe() to enter the "probe_failed" path and set
dev-&gt;driver to NULL. Before b8b2c7d845d5, real_probe() would assume
success if both dev-&gt;bus-&gt;probe and drv-&gt;probe were missing. As a result,
a device and driver could be "bound" together just by matching their names;
this doesn't work any more after b8b2c7d845d5.

This may cause problems later for certain usage of platform_driver_register()
and platform_device_register_simple(). I observed a panic while loading
the tpm_tis driver with parameter "force=1" (i.e. registering tpm_tis as
a platform driver), because tpm_tis_init's assumption that the device
returned by platform_device_register_simple() was bound didn't hold any more
(tpmm_chip_alloc() dereferences chip-&gt;pdev-&gt;driver, causing panic).

This patch restores the previous (4.3.0 and earlier) behavior of
platform_drv_probe() in the case when the associated platform driver has
no "probe" function.

Fixes: b8b2c7d845d5 ("base/platform: assert that dev_pm_domain callbacks are called unconditionally")
Signed-off-by: Martin Wilck &lt;Martin.Wilck@ts.fujitsu.com&gt;
Cc: Martin Fuzzey &lt;mfuzzey@parkeon.com&gt;
Acked-by: Jarkko Sakkinen &lt;jarkko.sakkinen@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>driver-core: platform: Provide helpers for multi-driver modules</title>
<updated>2015-10-05T04:02:40+00:00</updated>
<author>
<name>Thierry Reding</name>
<email>treding@nvidia.com</email>
</author>
<published>2015-09-25T15:29:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dbe2256ddd8e8420c254c79f4045c41cb5f4bd6b'/>
<id>urn:sha1:dbe2256ddd8e8420c254c79f4045c41cb5f4bd6b</id>
<content type='text'>
Some modules register several sub-drivers. Provide a helper that makes
it easy to register and unregister a list of sub-drivers, as well as
unwind properly on error.

Signed-off-by: Thierry Reding &lt;treding@nvidia.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>base/platform: assert that dev_pm_domain callbacks are called unconditionally</title>
<updated>2015-10-04T18:42:22+00:00</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2015-08-07T05:19:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b8b2c7d845d57f7a4b9f1f941f24728165e27626'/>
<id>urn:sha1:b8b2c7d845d57f7a4b9f1f941f24728165e27626</id>
<content type='text'>
When a platform driver doesn't provide a .remove callback the function
platform_drv_remove isn't called and so the call to dev_pm_domain_attach
called at probe time isn't paired by dev_pm_domain_detach at remove
time.

To fix this (and similar issues if different callbacks are missing) hook
up the driver callbacks unconditionally and make them aware that the
platform callbacks might be missing.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>drivercore: Fix unregistration path of platform devices</title>
<updated>2015-08-25T16:29:57+00:00</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2015-06-07T14:20:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7f5dcaf1fdf289767a126a0a5cc3ef39b5254b06'/>
<id>urn:sha1:7f5dcaf1fdf289767a126a0a5cc3ef39b5254b06</id>
<content type='text'>
The unregister path of platform_device is broken. On registration, it
will register all resources with either a parent already set, or
type==IORESOURCE_{IO,MEM}. However, on unregister it will release
everything with type==IORESOURCE_{IO,MEM}, but ignore the others. There
are also cases where resources don't get registered in the first place,
like with devices created by of_platform_populate()*.

Fix the unregister path to be symmetrical with the register path by
checking the parent pointer instead of the type field to decide which
resources to unregister. This is safe because the upshot of the
registration path algorithm is that registered resources have a parent
pointer, and non-registered resources do not.

* It can be argued that of_platform_populate() should be registering
  it's resources, and they argument has some merit. However, there are
  quite a few platforms that end up broken if we try to do that due to
  overlapping resources in the device tree. Until that is fixed, we need
  to solve the immediate problem.

Cc: Pantelis Antoniou &lt;pantelis.antoniou@konsulko.com&gt;
Cc: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Cc: Rob Herring &lt;robh@kernel.org&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
Tested-by: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Tested-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>Revert "base/platform: Only insert MEM and IO resources"</title>
<updated>2015-06-10T15:38:29+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2015-06-10T15:38:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0e6c861f73ec42ab5c89fda9892f2173c7aaf6cf'/>
<id>urn:sha1:0e6c861f73ec42ab5c89fda9892f2173c7aaf6cf</id>
<content type='text'>
This reverts commit 36d4b29260753ad78b1ce4363145332c02519adc as it
breaks working machines.

Cc: Rob Herring &lt;robh@kernel.org&gt;
Cc: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "base/platform: Continue on insert_resource() error"</title>
<updated>2015-06-10T15:38:02+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2015-06-10T15:38:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5da7f70997f772d7605c11d9e00018ffac463d92'/>
<id>urn:sha1:5da7f70997f772d7605c11d9e00018ffac463d92</id>
<content type='text'>
This reverts commit e50e69d1ac4232af0b6890f16929bf5ceee81538 as it
breaks working machines.

Cc: Rob Herring &lt;robh@kernel.org&gt;
Cc: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "base/platform: Remove code duplication"</title>
<updated>2015-06-10T15:36:50+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2015-06-10T15:36:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8b2dcebae330fb6dffc7717b740aa4b2c4d00451'/>
<id>urn:sha1:8b2dcebae330fb6dffc7717b740aa4b2c4d00451</id>
<content type='text'>
This reverts commit 6d9d4b1469b0d9748145e168fc9ec585e1f3f4b0 as it
breaks working machines.

Cc: Rob Herring &lt;robh@kernel.org&gt;
Cc: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>base/platform: Remove code duplication</title>
<updated>2015-06-01T01:15:17+00:00</updated>
<author>
<name>Ricardo Ribalda Delgado</name>
<email>ricardo.ribalda@gmail.com</email>
</author>
<published>2015-05-26T07:31:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6d9d4b1469b0d9748145e168fc9ec585e1f3f4b0'/>
<id>urn:sha1:6d9d4b1469b0d9748145e168fc9ec585e1f3f4b0</id>
<content type='text'>
Failure path of platform_device_add was almost the same as
platform_device_del. Refactor same code in a function.

Acked-by: Rob Herring &lt;robh@kernel.org&gt;
Signed-off-by: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>base/platform: Continue on insert_resource() error</title>
<updated>2015-06-01T01:15:17+00:00</updated>
<author>
<name>Ricardo Ribalda Delgado</name>
<email>ricardo.ribalda@gmail.com</email>
</author>
<published>2015-05-26T07:31:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e50e69d1ac4232af0b6890f16929bf5ceee81538'/>
<id>urn:sha1:e50e69d1ac4232af0b6890f16929bf5ceee81538</id>
<content type='text'>
insert_resource() can fail when the resource added  overlaps
(partially or fully) with another.

Device tree and AMBA devices may contain resources that overlap, so they
could not call platform_device_add (see 02bbde7849e6 ('Revert "of:
use platform_device_add"'))"

On the other hand, device trees are released using
platform_device_unregister(). This function calls platform_device_del(),
which calls release_resource(), that crashes when the resource has not
been added with with insert_resource. This was not an issue when the
device tree could not be modified online, but this is not the case
anymore.

This patch let the flow continue when there is an insert error, after
notifying the user with a dev_err(). r-&gt;parent is set to NULL, so
platform_device_del() knows that the resource was not added, and
therefore it should not be released.

Acked-by: Rob Herring &lt;robh@kernel.org&gt;
Signed-off-by: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>base/platform: Only insert MEM and IO resources</title>
<updated>2015-06-01T01:15:17+00:00</updated>
<author>
<name>Ricardo Ribalda Delgado</name>
<email>ricardo.ribalda@gmail.com</email>
</author>
<published>2015-05-26T07:31:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=36d4b29260753ad78b1ce4363145332c02519adc'/>
<id>urn:sha1:36d4b29260753ad78b1ce4363145332c02519adc</id>
<content type='text'>
platform_device_del only checks the type of the resource in order to
call release_resource.

On the other hand, platform_device_add calls insert_resource for any
resource that has a parent.

Make both code branches balanced.

Signed-off-by: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
