Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/792473/?format=api
{ "id": 792473, "url": "http://patchwork.ozlabs.org/api/patches/792473/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20170722185537.12696-1-hdegoede@redhat.com/", "project": { "id": 35, "url": "http://patchwork.ozlabs.org/api/projects/35/?format=api", "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": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170722185537.12696-1-hdegoede@redhat.com>", "list_archive_url": null, "date": "2017-07-22T18:55:36", "name": "[1/2] i2c: core: Allow the driver to override the default i2c_bus match behavior", "commit_ref": null, "pull_url": null, "state": "rejected", "archived": false, "hash": "8f06b6c4d79650d10475846fe1d063edb001c3f0", "submitter": { "id": 1893, "url": "http://patchwork.ozlabs.org/api/people/1893/?format=api", "name": "Hans de Goede", "email": "hdegoede@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20170722185537.12696-1-hdegoede@redhat.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/792473/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/792473/checks/", "tags": {}, "related": [], "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-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=pass 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 3xFGzz6LQ6z9s3w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 23 Jul 2017 04:55:43 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1750921AbdGVSzm (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tSat, 22 Jul 2017 14:55:42 -0400", "from mx1.redhat.com ([209.132.183.28]:50050 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1750865AbdGVSzl (ORCPT <rfc822;linux-i2c@vger.kernel.org>);\n\tSat, 22 Jul 2017 14:55:41 -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 300963680A;\n\tSat, 22 Jul 2017 18:55:41 +0000 (UTC)", "from shalem.localdomain.com (ovpn-116-48.ams2.redhat.com\n\t[10.36.116.48])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id CA97B5D6A4;\n\tSat, 22 Jul 2017 18:55:37 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 300963680A", "DKIM-Filter": "OpenDKIM Filter v2.11.0 mx1.redhat.com 300963680A", "From": "Hans de Goede <hdegoede@redhat.com>", "To": "Jiri Kosina <jikos@kernel.org>,\n\tBenjamin Tissoires <benjamin.tissoires@redhat.com>,\n\tWolfram Sang <wsa@the-dreams.de>", "Cc": "Hans de Goede <hdegoede@redhat.com>, linux-input@vger.kernel.org,\n\tlinux-i2c@vger.kernel.org", "Subject": "[PATCH 1/2] i2c: core: Allow the driver to override the default\n\ti2c_bus match behavior", "Date": "Sat, 22 Jul 2017 20:55:36 +0200", "Message-Id": "<20170722185537.12696-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.30]);\n\tSat, 22 Jul 2017 18:55:41 +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": "Some ACPI devices report multiple ids for a single i2c_client, while not\nreally implementing the hw-interface asociated with some of these ids.\n\nFor some of these devices calling probe and having probe fail with\n-ENODEV is a problem in itself as this causes the device to be\npowered-up and down again (causes its PS0 and PS3 ACPI methods to be\nexecuted) which puts some devices in an unusable state.\n\nThis commit adds a match callback to i2c_driver, allowing drivers to\noverride the default i2c_bus match behavior and tell the core they\nare not the right driver for the device, avoiding i2c_bus_type.probe\ngetting called, avoiding the undesirable power up / down cycle.\n\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\n---\n drivers/i2c/i2c-core-base.c | 12 +++++++++---\n include/linux/i2c.h | 6 ++++++\n 2 files changed, 15 insertions(+), 3 deletions(-)", "diff": "diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c\nindex c89dac7fd2e7..2c6702f2347b 100644\n--- a/drivers/i2c/i2c-core-base.c\n+++ b/drivers/i2c/i2c-core-base.c\n@@ -98,8 +98,16 @@ EXPORT_SYMBOL_GPL(i2c_match_id);\n static int i2c_device_match(struct device *dev, struct device_driver *drv)\n {\n \tstruct i2c_client\t*client = i2c_verify_client(dev);\n-\tstruct i2c_driver\t*driver;\n+\tstruct i2c_driver\t*driver = to_i2c_driver(drv);\n+\tint ret;\n \n+\tif (driver->match && client) {\n+\t\tret = driver->match(client);\n+\t\tif (ret < 0)\n+\t\t\treturn 0;\n+\t\tif (ret > 0)\n+\t\t\treturn 1;\n+\t}\n \n \t/* Attempt an OF style match */\n \tif (i2c_of_match_device(drv->of_match_table, client))\n@@ -109,8 +117,6 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv)\n \tif (acpi_driver_match_device(dev, drv))\n \t\treturn 1;\n \n-\tdriver = to_i2c_driver(drv);\n-\n \t/* Finally an I2C match */\n \tif (i2c_match_id(driver->id_table, client))\n \t\treturn 1;\ndiff --git a/include/linux/i2c.h b/include/linux/i2c.h\nindex 00ca5b86a753..670577c82bc3 100644\n--- a/include/linux/i2c.h\n+++ b/include/linux/i2c.h\n@@ -139,6 +139,9 @@ enum i2c_alert_protocol {\n * struct i2c_driver - represent an I2C device driver\n * @class: What kind of i2c device we instantiate (for detect)\n * @attach_adapter: Callback for bus addition (deprecated)\n+ * @match: Allows the driver to override the default i2c_bus match behavior\n+ * return < 0 to fail the match, > 0 to force a match, 0 to fallback\n+ * to default id matching\n * @probe: Callback for device binding - soon to be deprecated\n * @probe_new: New callback for device binding\n * @remove: Callback for device unbinding\n@@ -180,6 +183,9 @@ struct i2c_driver {\n \t */\n \tint (*attach_adapter)(struct i2c_adapter *) __deprecated;\n \n+\t/* Set this to override standard i2c_bus match behavior */\n+\tint (*match)(struct i2c_client *);\n+\n \t/* Standard driver model interfaces */\n \tint (*probe)(struct i2c_client *, const struct i2c_device_id *);\n \tint (*remove)(struct i2c_client *);\n", "prefixes": [ "1/2" ] }