Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1279981

[PATCH v2 11/16] driver core: Do not overwrite secondary fwnode with NULL if it is set

From Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH v2 11/16] driver core: Do not overwrite secondary fwnode with NULL if it is set
Date 2015-11-30 16:20 +0100
Message-ID <qAypc-5id-35@gated-at.bofh.it> (permalink)
References <qAypb-5id-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Mika Westerberg <mika.westerberg@linux.intel.com>

If multiple devices share single firmware node like it is case with MFD
devices, the same firmware node (ACPI) is assigned to all of them. The
function also modifies the shared firmware node in order to preserve
secondary firmware node of the device in question.

If the new device which is sharing the firmware node does not have
secondary node it will be NULL which will be assigned to the secondary node
of the shared firmware node losing all built-in properties.

Prevent this by setting the secondary firmware node only if the replacement
is non-NULL.

Print also warning if someone tries to overwrite secondary node that has
already been assigned.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index b7d56c5..0a8bdad 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2261,7 +2261,10 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
 		if (fwnode_is_primary(fn))
 			fn = fn->secondary;
 
-		fwnode->secondary = fn;
+		if (fn) {
+			WARN_ON(fwnode->secondary);
+			fwnode->secondary = fn;
+		}
 		dev->fwnode = fwnode;
 	} else {
 		dev->fwnode = fwnode_is_primary(dev->fwnode) ?
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/16] intel-lpss: support non-ACPI platforms Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 11/16] driver core: Do not overwrite secondary fwnode with NULL if it is set Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 03/16] device property: refactor built-in properties support Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 12/16] mfd: core: propagate device properties to sub devices drivers Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 01/16] device property: always check for fwnode type Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 16/16] i2c: designware: Convert to use unified device property API Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
    Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Wolfram Sang <wsa@the-dreams.de> - 2015-11-30 21:00 +0100
      Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-12-01 10:10 +0100
      Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-12-01 11:40 +0100
        Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device property API "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-02 02:00 +0100
          Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-12-02 10:30 +0100
            Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-12-02 10:40 +0100
              Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Wolfram Sang <wsa@the-dreams.de> - 2015-12-02 11:00 +0100
  [PATCH v2 14/16] mfd: intel-lpss: Pass SDA hold time to I2C host controller driver Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 15/16] mfd: intel-lpss: Pass HSUART configuration via properties Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 13/16] mfd: intel-lpss: Add support for passing device properties Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  Re: [PATCH v2 00/16] intel-lpss: support non-ACPI platforms "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-07 02:20 +0100

csiph-web