Received: by 10.213.65.68 with SMTP id h4csp547975imn; Fri, 30 Mar 2018 10:28:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx49nSjicO6nm/XSOaD/z/ZAjXhiFxK5CLZaCo538WA12/YWSmNHulW7yltP8BCMScGgszA3G X-Received: by 10.99.3.216 with SMTP id 207mr9036003pgd.163.1522430922831; Fri, 30 Mar 2018 10:28:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522430922; cv=none; d=google.com; s=arc-20160816; b=WPwyEO4vHGaRu9Wi80nO3Z6DI9tHkf9iVM1It3DgSu8jH/RXW9jw3ERw+pOYUJuACY NeB9uXcaVQPzChYhrIg0CrUshA6Md+WJDx+HJZaHMArF4DvhoRlhXco8fahwoYg8Ekyt SxVXEpA1CbIdke1AtpOVDjGnVpSMq68RIXxRkOHkOWL2vqqJ8cjaWrW6a6QQwCqbx2nk mGw5XXmUIr7vNXYeVDPONg2CyiBUMYeS+Nn4rnMcBdxSB2FZn/imYfctWM1GYavYRLVh 56wCPqA/vNoJyRLCPIz6IuGsqDeen6QNX+U0HEEHM49lMgNYC3dxloACYTZ1QSMCeVTs NwxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=JaYXn/aKV3G5FOWE/x8OHWi2BXI3/99B+4xnYCVQSkc=; b=eSuNOltQI34Q4P6Eyp2BQuwE2Cg3/qkBURfLlhXrMJ33WqmSAwh0/qoqaW+9wMzgWo pQrJVuSWK0cKSrGZERUto8nrZaYsL7qVRcywkVQEgDVL4C9YLkDvJWNZgswFXptXGqXm aeDJthsRIsKb8/pcd57Y/fZ9Ee3E1J4HywMMDf62mzIKQOagdnSdqYJflDIuZQVkHe4b af/RfYozweN7VjI2nMAh/+MhsFXHWn/Vf2skDCSiPXCX4eHAzy/TF2sZAUqp5v/TldG1 0aVjwsmQaHhcvX9yzghPkzMj2guJX9PVVBJBoTYiL3aJl6SiJUrH9jiVdDQumsRTiADq LiAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bg10-v6si8978164plb.30.2018.03.30.10.28.29; Fri, 30 Mar 2018 10:28:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752632AbeC3RYf (ORCPT + 99 others); Fri, 30 Mar 2018 13:24:35 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58936 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752431AbeC3RYd (ORCPT ); Fri, 30 Mar 2018 13:24:33 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 1F2AF260BD3 From: Sebastian Reichel To: Sebastian Reichel , Milo Kim , Lee Jones , Daniel Thompson , Rob Herring , Tony Lindgren Cc: Jingoo Han , Mark Rutland , linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, devicetree@vger.kernel.org, linux-omap@vger.kernel.org, Sebastian Reichel Subject: [PATCHv4 05/10] mfd: ti-lmu: use of_device_get_match_data() helper Date: Fri, 30 Mar 2018 19:24:09 +0200 Message-Id: <20180330172414.26575-6-sebastian.reichel@collabora.co.uk> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180330172414.26575-1-sebastian.reichel@collabora.co.uk> References: <20180330172414.26575-1-sebastian.reichel@collabora.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace of_match_device() with of_device_get_match_data(), which slightly decreases lines of code and allows to move the DT table next to the I2C table. Signed-off-by: Sebastian Reichel --- drivers/mfd/ti-lmu.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/mfd/ti-lmu.c b/drivers/mfd/ti-lmu.c index de76298cf3a8..ce16c896879b 100644 --- a/drivers/mfd/ti-lmu.c +++ b/drivers/mfd/ti-lmu.c @@ -142,34 +142,21 @@ TI_LMU_DATA(lm3633, LM3633_MAX_REG); TI_LMU_DATA(lm3695, LM3695_MAX_REG); TI_LMU_DATA(lm3697, LM3697_MAX_REG); -static const struct of_device_id ti_lmu_of_match[] = { - { .compatible = "ti,lm3532", .data = &lm3532_data }, - { .compatible = "ti,lm3631", .data = &lm3631_data }, - { .compatible = "ti,lm3632", .data = &lm3632_data }, - { .compatible = "ti,lm3633", .data = &lm3633_data }, - { .compatible = "ti,lm3695", .data = &lm3695_data }, - { .compatible = "ti,lm3697", .data = &lm3697_data }, - { } -}; -MODULE_DEVICE_TABLE(of, ti_lmu_of_match); - static int ti_lmu_probe(struct i2c_client *cl, const struct i2c_device_id *id) { struct device *dev = &cl->dev; - const struct of_device_id *match; const struct ti_lmu_data *data; struct regmap_config regmap_cfg; struct ti_lmu *lmu; int ret; - match = of_match_device(ti_lmu_of_match, dev); - if (!match) - return -ENODEV; /* * Get device specific data from of_match table. * This data is defined by using TI_LMU_DATA() macro. */ - data = (struct ti_lmu_data *)match->data; + data = of_device_get_match_data(dev); + if (!data) + return -ENODEV; lmu = devm_kzalloc(dev, sizeof(*lmu), GFP_KERNEL); if (!lmu) @@ -217,6 +204,17 @@ static int ti_lmu_probe(struct i2c_client *cl, const struct i2c_device_id *id) data->num_cells, NULL, 0, NULL); } +static const struct of_device_id ti_lmu_of_match[] = { + { .compatible = "ti,lm3532", .data = &lm3532_data }, + { .compatible = "ti,lm3631", .data = &lm3631_data }, + { .compatible = "ti,lm3632", .data = &lm3632_data }, + { .compatible = "ti,lm3633", .data = &lm3633_data }, + { .compatible = "ti,lm3695", .data = &lm3695_data }, + { .compatible = "ti,lm3697", .data = &lm3697_data }, + { } +}; +MODULE_DEVICE_TABLE(of, ti_lmu_of_match); + static const struct i2c_device_id ti_lmu_ids[] = { { "lm3532", LM3532 }, { "lm3631", LM3631 }, -- 2.16.2