From patchwork Mon Sep 16 13:51:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 275223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B2D102C00E9 for ; Mon, 16 Sep 2013 23:51:39 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752993Ab3IPNvZ (ORCPT ); Mon, 16 Sep 2013 09:51:25 -0400 Received: from cassiel.sirena.org.uk ([80.68.93.111]:33556 "EHLO cassiel.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753271Ab3IPNvX (ORCPT ); Mon, 16 Sep 2013 09:51:23 -0400 Received: from cpc11-sgyl31-2-0-cust68.sgyl.cable.virginmedia.com ([94.175.92.69] helo=finisterre) by cassiel.sirena.org.uk with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1VLZCx-00028x-3B; Mon, 16 Sep 2013 14:51:20 +0100 Received: from broonie by finisterre with local (Exim 4.80) (envelope-from ) id 1VLZCw-00085d-5G; Mon, 16 Sep 2013 14:51:18 +0100 Date: Mon, 16 Sep 2013 14:51:18 +0100 From: Mark Brown To: Linus Walleij Cc: Wolfram Sang , "linux-i2c@vger.kernel.org" , Lee Jones , Samuel Ortiz , "linux-kernel@vger.kernel.org" , Wang Shilong Message-ID: <20130916135118.GD29403@sirena.org.uk> References: <1379094851-26385-1-git-send-email-linus.walleij@linaro.org> <20130916091956.GF3999@lee--X1> <20130916104009.GA29403@sirena.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Cookie: Your present plans will be successful. User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 94.175.92.69 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on cassiel.sirena.org.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.2 Subject: Re: [PATCH 1/4 v2] mfd: add STw481x driver X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:57:07 +0000) X-SA-Exim-Scanned: Yes (on cassiel.sirena.org.uk) Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org On Mon, Sep 16, 2013 at 02:44:35PM +0200, Linus Walleij wrote: > I've tried to fix this for DT-only I2C devices > and this very driver was the reason. > But a tiresome regression due to drivers relying on this > i2c_device_id not being NULL and inability to remove it from the I2C > core without refactoring the world ensued, see: > commit c80f52847c50109ca248c22efbf71ff10553dca4 Oh, that was the change... > Reverted in: > commit 661f6c1cd926c6c973e03c6b5151d161f3a666ed > For this reason I think: > http://marc.info/?l=linux-next&m=137148411231784&w=2 > I have tentatively given up getting pure DT I2C drivers > to probe, I don't think I have the whole picture, but > Wolfram has serious doubts about this and say we have > to be careful .... > Wolfram, do you have some ideas on how we should > proceed or ar you happy with merging this as-is? I'd have expected that it should be possible to change things such that the change in the core doesn't produce any change in behaviour for existing drivers. Can we not change the patch so that i2c_match_id() copes with getting a NULL id_table? Something like this: diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 29d3f04..61087ea 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -67,6 +67,9 @@ static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver); static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, const struct i2c_client *client) { + if (!id) + return NULL; + while (id->name[0]) { if (strcmp(client->name, id->name) == 0) return id; @@ -92,11 +95,8 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv) return 1; driver = to_i2c_driver(drv); - /* match on an id table if there is one */ - if (driver->id_table) - return i2c_match_id(driver->id_table, client) != NULL; - return 0; + return i2c_match_id(driver->id_table, client) != NULL; } @@ -246,7 +246,7 @@ static int i2c_device_probe(struct device *dev) return 0; driver = to_i2c_driver(dev->driver); - if (!driver->probe || !driver->id_table) + if (!driver->probe) return -ENODEV; client->driver = driver; if (!device_can_wakeup(&client->dev))