public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Grant Likely <grant.likely@secretlab•ca>,
	Wolfram Sang <wsa@the-dreams•de>
Cc: linux-next@vger•kernel.org, linux-kernel@vger•kernel.org,
	Pantelis Antoniou <pantelis.antoniou@konsulko•com>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard•com>
Subject: linux-next: manual merge of the devicetree tree with the i2c tree
Date: Wed, 26 Nov 2014 15:33:53 +1100	[thread overview]
Message-ID: <20141126153353.5f4fedd5@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 4264 bytes --]

Hi Grant,

Today's linux-next merge of the devicetree tree got a conflict in
drivers/i2c/i2c-core.c between commit 2fd36c552649 ("i2c: core: Map OF
IRQ at probe time") from the  i2c tree and commit a430a3455f2c
("i2c/of: Factor out Devicetree registration code") from the devicetree
tree.

I fixed it up (thanks for the heads up, but please see below) and can
carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb•auug.org.au

diff --cc drivers/i2c/i2c-core.c
index 19800033e75d,d8afd3f28ca4..000000000000
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@@ -1380,61 -1369,69 +1381,67 @@@ static void i2c_scan_static_board_info(
  /* OF support code */
  
  #if IS_ENABLED(CONFIG_OF)
- static void of_i2c_register_devices(struct i2c_adapter *adap)
+ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap,
+ 						 struct device_node *node)
  {
- 	void *result;
- 	struct device_node *node;
+ 	struct i2c_client *result;
+ 	struct i2c_board_info info = {};
+ 	struct dev_archdata dev_ad = {};
+ 	const __be32 *addr;
+ 	int len;
  
- 	/* Only register child devices if the adapter has a node pointer set */
- 	if (!adap->dev.of_node)
- 		return;
+ 	dev_dbg(&adap->dev, "of_i2c: register %s\n", node->full_name);
  
- 	dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");
+ 	if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) {
+ 		dev_err(&adap->dev, "of_i2c: modalias failure on %s\n",
+ 			node->full_name);
+ 		return ERR_PTR(-EINVAL);
+ 	}
  
- 	for_each_available_child_of_node(adap->dev.of_node, node) {
- 		struct i2c_board_info info = {};
- 		struct dev_archdata dev_ad = {};
- 		const __be32 *addr;
- 		int len;
+ 	addr = of_get_property(node, "reg", &len);
+ 	if (!addr || (len < sizeof(int))) {
+ 		dev_err(&adap->dev, "of_i2c: invalid reg on %s\n",
+ 			node->full_name);
+ 		return ERR_PTR(-EINVAL);
+ 	}
  
- 		dev_dbg(&adap->dev, "of_i2c: register %s\n", node->full_name);
+ 	info.addr = be32_to_cpup(addr);
+ 	if (info.addr > (1 << 10) - 1) {
+ 		dev_err(&adap->dev, "of_i2c: invalid addr=%x on %s\n",
+ 			info.addr, node->full_name);
+ 		return ERR_PTR(-EINVAL);
+ 	}
  
- 		if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) {
- 			dev_err(&adap->dev, "of_i2c: modalias failure on %s\n",
- 				node->full_name);
- 			continue;
- 		}
 -	info.irq = irq_of_parse_and_map(node, 0);
+ 	info.of_node = of_node_get(node);
+ 	info.archdata = &dev_ad;
  
- 		addr = of_get_property(node, "reg", &len);
- 		if (!addr || (len < sizeof(int))) {
- 			dev_err(&adap->dev, "of_i2c: invalid reg on %s\n",
- 				node->full_name);
- 			continue;
- 		}
+ 	if (of_get_property(node, "wakeup-source", NULL))
+ 		info.flags |= I2C_CLIENT_WAKE;
  
- 		info.addr = be32_to_cpup(addr);
- 		if (info.addr > (1 << 10) - 1) {
- 			dev_err(&adap->dev, "of_i2c: invalid addr=%x on %s\n",
- 				info.addr, node->full_name);
- 			continue;
- 		}
+ 	request_module("%s%s", I2C_MODULE_PREFIX, info.type);
  
- 		info.of_node = of_node_get(node);
- 		info.archdata = &dev_ad;
+ 	result = i2c_new_device(adap, &info);
+ 	if (result == NULL) {
+ 		dev_err(&adap->dev, "of_i2c: Failure registering %s\n",
+ 			node->full_name);
+ 		of_node_put(node);
 -		irq_dispose_mapping(info.irq);
+ 		return ERR_PTR(-EINVAL);
+ 	}
+ 	return result;
+ }
  
- 		if (of_get_property(node, "wakeup-source", NULL))
- 			info.flags |= I2C_CLIENT_WAKE;
+ static void of_i2c_register_devices(struct i2c_adapter *adap)
+ {
+ 	struct device_node *node;
  
- 		request_module("%s%s", I2C_MODULE_PREFIX, info.type);
+ 	/* Only register child devices if the adapter has a node pointer set */
+ 	if (!adap->dev.of_node)
+ 		return;
  
- 		result = i2c_new_device(adap, &info);
- 		if (result == NULL) {
- 			dev_err(&adap->dev, "of_i2c: Failure registering %s\n",
- 				node->full_name);
- 			of_node_put(node);
- 			continue;
- 		}
- 	}
+ 	dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");
+ 
+ 	for_each_available_child_of_node(adap->dev.of_node, node)
+ 		of_i2c_register_device(adap, node);
  }
  
  static int of_dev_node_match(struct device *dev, void *data)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

                 reply	other threads:[~2014-11-26  4:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20141126153353.5f4fedd5@canb.auug.org.au \
    --to=sfr@canb$(echo .)auug.org.au \
    --cc=grant.likely@secretlab$(echo .)ca \
    --cc=laurent.pinchart+renesas@ideasonboard$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=pantelis.antoniou@konsulko$(echo .)com \
    --cc=wsa@the-dreams$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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