{"id":807555,"url":"http://patchwork.ozlabs.org/api/1.0/patches/807555/?format=json","project":{"id":35,"url":"http://patchwork.ozlabs.org/api/1.0/projects/35/?format=json","name":"Linux I2C development","link_name":"linux-i2c","list_id":"linux-i2c.vger.kernel.org","list_email":"linux-i2c@vger.kernel.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20170830094814.17758-2-hdegoede@redhat.com>","date":"2017-08-30T09:48:04","name":"[v3,01/11] i2c: Allow overriding dev_name through board_info","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"4e9c55058b2500316a3380b48698f3925df010fb","submitter":{"id":1893,"url":"http://patchwork.ozlabs.org/api/1.0/people/1893/?format=json","name":"Hans de Goede","email":"hdegoede@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-i2c/patch/20170830094814.17758-2-hdegoede@redhat.com/mbox/","series":[{"id":564,"url":"http://patchwork.ozlabs.org/api/1.0/series/564/?format=json","date":"2017-08-30T09:48:14","name":"Hookup typec power-negotation to the PMIC and charger","version":3,"mbox":"http://patchwork.ozlabs.org/series/564/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807555/checks/","tags":{},"headers":{"Return-Path":"<linux-i2c-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=hdegoede@redhat.com"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xj15F08xSz9sNn\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 19:52:33 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751385AbdH3JsZ (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tWed, 30 Aug 2017 05:48:25 -0400","from mx1.redhat.com ([209.132.183.28]:60716 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751242AbdH3JsX (ORCPT <rfc822;linux-i2c@vger.kernel.org>);\n\tWed, 30 Aug 2017 05:48:23 -0400","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id B664C61462;\n\tWed, 30 Aug 2017 09:48:22 +0000 (UTC)","from shalem.localdomain.com (ovpn-116-238.ams2.redhat.com\n\t[10.36.116.238])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 1D20587C87;\n\tWed, 30 Aug 2017 09:48:18 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com B664C61462","From":"Hans de Goede <hdegoede@redhat.com>","To":"Darren Hart <dvhart@infradead.org>, Andy Shevchenko <andy@infradead.org>,\n\tWolfram Sang <wsa@the-dreams.de>, Sebastian Reichel <sre@kernel.org>,\n\tGreg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\tGuenter Roeck <linux@roeck-us.net>,\n\tHeikki Krogerus <heikki.krogerus@linux.intel.com>","Cc":"Hans de Goede <hdegoede@redhat.com>,\n\tplatform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tlinux-i2c@vger.kernel.org, Liam Breck <liam@networkimprov.net>,\n\tTony Lindgren <tony@atomide.com>, linux-pm@vger.kernel.org,\n\tdevel@driverdev.osuosl.org","Subject":"[PATCH v3 01/11] i2c: Allow overriding dev_name through board_info","Date":"Wed, 30 Aug 2017 11:48:04 +0200","Message-Id":"<20170830094814.17758-2-hdegoede@redhat.com>","In-Reply-To":"<20170830094814.17758-1-hdegoede@redhat.com>","References":"<20170830094814.17758-1-hdegoede@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.15","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tWed, 30 Aug 2017 09:48:22 +0000 (UTC)","Sender":"linux-i2c-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-i2c.vger.kernel.org>","X-Mailing-List":"linux-i2c@vger.kernel.org"},"content":"For devices not instantiated through ACPI the i2c-client's device-name\ngets set to <busnr>-<addr> by default, e.g. \"0-0022\" this means that\nthe device-name is dependent on the order in which the i2c-busses are\nenumerated.\n\nIn some cases having a predictable constant device-name is desirable,\nfor example on non device-tree platforms the link between a regulator\nand its consumers is specified by the platform code by setting\nregulator_init_data.consumers. This array identifies the regulator's\nconsumers by dev_name and supply(-name). Which requires a constant\ndev_name.\n\nThis commit adds a dev_name field to i2c_board_info allowing\nplatform code to set a contstant dev_name so that the device can\nbe identified by its dev_name in other platform code.\n\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\n---\n drivers/i2c/i2c-core-base.c | 10 ++++++++--\n include/linux/i2c.h         |  2 ++\n 2 files changed, 10 insertions(+), 2 deletions(-)","diff":"diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c\nindex 45fafcc88b93..5cdf3b947c23 100644\n--- a/drivers/i2c/i2c-core-base.c\n+++ b/drivers/i2c/i2c-core-base.c\n@@ -672,10 +672,16 @@ static void i2c_adapter_unlock_bus(struct i2c_adapter *adapter,\n }\n \n static void i2c_dev_set_name(struct i2c_adapter *adap,\n-\t\t\t     struct i2c_client *client)\n+\t\t\t     struct i2c_client *client,\n+\t\t\t     struct i2c_board_info const *info)\n {\n \tstruct acpi_device *adev = ACPI_COMPANION(&client->dev);\n \n+\tif (info && info->dev_name) {\n+\t\tdev_set_name(&client->dev, \"i2c-%s\", info->dev_name);\n+\t\treturn;\n+\t}\n+\n \tif (adev) {\n \t\tdev_set_name(&client->dev, \"i2c-%s\", acpi_dev_name(adev));\n \t\treturn;\n@@ -772,7 +778,7 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)\n \tclient->dev.of_node = info->of_node;\n \tclient->dev.fwnode = info->fwnode;\n \n-\ti2c_dev_set_name(adap, client);\n+\ti2c_dev_set_name(adap, client, info);\n \n \tif (info->properties) {\n \t\tstatus = device_add_properties(&client->dev, info->properties);\ndiff --git a/include/linux/i2c.h b/include/linux/i2c.h\nindex 701ad26fa6b4..d3655cfe9a3e 100644\n--- a/include/linux/i2c.h\n+++ b/include/linux/i2c.h\n@@ -310,6 +310,7 @@ static inline bool i2c_detect_slave_mode(struct device *dev) { return false; }\n  * @type: chip type, to initialize i2c_client.name\n  * @flags: to initialize i2c_client.flags\n  * @addr: stored in i2c_client.addr\n+ * @dev_name: Overrides the default <busnr>-<addr> dev_name if set\n  * @platform_data: stored in i2c_client.dev.platform_data\n  * @archdata: copied into i2c_client.dev.archdata\n  * @of_node: pointer to OpenFirmware device node\n@@ -334,6 +335,7 @@ struct i2c_board_info {\n \tchar\t\ttype[I2C_NAME_SIZE];\n \tunsigned short\tflags;\n \tunsigned short\taddr;\n+\tconst char\t*dev_name;\n \tvoid\t\t*platform_data;\n \tstruct dev_archdata\t*archdata;\n \tstruct device_node *of_node;\n","prefixes":["v3","01/11"]}