Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752721AbdHBTMY (ORCPT ); Wed, 2 Aug 2017 15:12:24 -0400 Received: from avon.wwwdotorg.org ([104.237.132.123]:40614 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751197AbdHBTMX (ORCPT ); Wed, 2 Aug 2017 15:12:23 -0400 X-Greylist: delayed 429 seconds by postgrey-1.27 at vger.kernel.org; Wed, 02 Aug 2017 15:12:23 EDT Subject: Re: [PATCH 1/2] i2c: mux: pinctrl: remove platform_data To: Peter Rosin Cc: linux-kernel@vger.kernel.org, Wolfram Sang , Stephen Warren , linux-i2c@vger.kernel.org References: <20170802072728.24586-1-peda@axentia.se> <20170802072728.24586-2-peda@axentia.se> From: Stephen Warren Message-ID: Date: Wed, 2 Aug 2017 13:05:09 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170802072728.24586-2-peda@axentia.se> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1698 Lines: 44 On 08/02/2017 01:27 AM, Peter Rosin wrote: > No platform (at least no upstreamed platform) has ever used this > platform_data. Just drop it and simplify the code. > diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c > static int i2c_mux_pinctrl_probe(struct platform_device *pdev) (eliding some - lines for brevity in the following): > + for (i = 0; i < num_names; i++) { > + ret = of_property_read_string_index(np, "pinctrl-names", i, > + &name); > + if (ret < 0) { > + dev_err(dev, "Cannot parse pinctrl-names: %d\n", ret); > + goto err_put_parent; > + } > + > + mux->states[i] = pinctrl_lookup_state(mux->pinctrl, name); > if (IS_ERR(mux->states[i])) { > ret = PTR_ERR(mux->states[i]); > + dev_err(dev, "Cannot look up pinctrl state %s: %d\n", > + name, ret); > + goto err_put_parent; This error path doesn't undo pinctrl_lookup_state. Is that OK? I think so, but wanted to check. > + muxc = i2c_mux_alloc(parent, dev, num_names, > + sizeof(*mux) + num_names * sizeof(*mux->states), > + 0, i2c_mux_pinctrl_select, NULL); ... > + /* Do not add any adapter for the idle state (if it's there at all). */ > + for (i = 0; i < num_names - !!mux->state_idle; i++) { > + ret = i2c_mux_add_adapter(muxc, 0, i, 0); Is it OK to potentially add one fewer adapter here than the child bus count passed to i2c_mux_alloc() earlier? The old code specifically excluded the idle state (if present) from the child bus count passed to i2c_mux_alloc(), which was aided by the fact that it parsed the DT before calling i2c_mux_alloc(). If those two things are OK, then: Reviewed-by: Stephen Warren