From patchwork Mon Dec 19 15:16:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9480477 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8C571601C2 for ; Mon, 19 Dec 2016 15:18:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 778D02840E for ; Mon, 19 Dec 2016 15:18:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AFE6284E6; Mon, 19 Dec 2016 15:18:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 228BD2840E for ; Mon, 19 Dec 2016 15:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755557AbcLSPSe (ORCPT ); Mon, 19 Dec 2016 10:18:34 -0500 Received: from mail-wj0-f193.google.com ([209.85.210.193]:36204 "EHLO mail-wj0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755485AbcLSPSd (ORCPT ); Mon, 19 Dec 2016 10:18:33 -0500 Received: by mail-wj0-f193.google.com with SMTP id j10so24021793wjb.3; Mon, 19 Dec 2016 07:18:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ZjCiB5yAUPoHHFiO40FJkOIYD9Jvad3WvmKtFjXoNHQ=; b=txVKxmLDq//Rqgp/IXyHKp6ODbIiq/2c6dp6Bysr5lomN+nlCk88LO1qfyp20RoDLJ 1hZVpIXkXXTGsp8JZuf0h//DVf2HI0uqHaiT75RLilFtX8ohUitNLu6cnhom9uqVY1m9 lq4a6B/VRy2kuykKToQTr4alo75dbwruwGjgm5yZatsJpGD7BEilabYx63oRGGO6Y3Q5 btcZieomGVQWUCfSUf/rRJWyZP+dBGeijQe9qVqdfWckOENiQRG7VareFwGN1Pt79l/Q kfA1R/7E2W/p3baCDmerUb955psjKivLLyH+rtfyIU/j46sEk/gyouEwX+l2Tvo2LWFz 53nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZjCiB5yAUPoHHFiO40FJkOIYD9Jvad3WvmKtFjXoNHQ=; b=MEwmSTjQoBV/QE3bCKoqna9jU7yzCWijnh28iTctf70QC65dkrm+IwgM7L76h+m2cd ZILvnmY8ifFGdWWjGjrlKx/KTej6YvmHyUMKsxFpBIh82wThtA9dyv3FEpKjx30lAhwe 4VdbH4VTxk25ZRZkT1uQNQBei39bFsxXCKohlPlRnmu4gjA3IqD61H9rTEl0UkdYu23J fZB2gzvmX7lpB03uLX50jYgoOTurnodBi2X+q4wiJsRPXRWOPYbbJrhi68p4KNENG0jo IMXe5uwRZrpOS8ukX42RPy11lFyFmY4wCGSClH3LAiH4PbXoB1U2NqCKiBGYPsLlMphR o81A== X-Gm-Message-State: AIkVDXJSa9YvyQ6xRiimiutEaTde5xj37tLSxpXvuWuzv7yuI8DThwANUfrOgTubOAanUg== X-Received: by 10.194.41.163 with SMTP id g3mr13880691wjl.162.1482160711716; Mon, 19 Dec 2016 07:18:31 -0800 (PST) Received: from Red.local (LFbn-1-7035-57.w90-116.abo.wanadoo.fr. [90.116.208.57]) by smtp.googlemail.com with ESMTPSA id d184sm17729359wmd.8.2016.12.19.07.18.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Dec 2016 07:18:31 -0800 (PST) From: Corentin Labbe To: tony@atomide.com, lee.jones@linaro.org, linux-omap@vger.kernel.org Cc: linux-kernel@vger.kernel.org, LABBE Corentin Subject: [PATCH] mfd: palmas: constify struct regmap_irq_chip Date: Mon, 19 Dec 2016 16:16:23 +0100 Message-Id: <20161219151623.20189-1-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.10.2 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: LABBE Corentin The regmap_irq_chip struct is never modified and so can be set as const. This permit to remove a casted access to match->data and use the proper of_device_get_match_data() Signed-off-by: Corentin Labbe --- drivers/mfd/palmas.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index 8f8bacb..66f3aa0 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c @@ -300,7 +300,7 @@ static const struct regmap_irq palmas_irqs[] = { }, }; -static struct regmap_irq_chip palmas_irq_chip = { +static const struct regmap_irq_chip palmas_irq_chip = { .name = "palmas", .irqs = palmas_irqs, .num_irqs = ARRAY_SIZE(palmas_irqs), @@ -313,7 +313,7 @@ static struct regmap_irq_chip palmas_irq_chip = { PALMAS_INT1_MASK), }; -static struct regmap_irq_chip tps65917_irq_chip = { +static const struct regmap_irq_chip tps65917_irq_chip = { .name = "tps65917", .irqs = tps65917_irqs, .num_irqs = ARRAY_SIZE(tps65917_irqs), @@ -453,20 +453,20 @@ static unsigned int tps659038_features; struct palmas_driver_data { unsigned int *features; - struct regmap_irq_chip *irq_chip; + const struct regmap_irq_chip *irq_chip; }; -static struct palmas_driver_data palmas_data = { +static const struct palmas_driver_data palmas_data = { .features = &palmas_features, .irq_chip = &palmas_irq_chip, }; -static struct palmas_driver_data tps659038_data = { +static const struct palmas_driver_data tps659038_data = { .features = &tps659038_features, .irq_chip = &palmas_irq_chip, }; -static struct palmas_driver_data tps65917_data = { +static const struct palmas_driver_data tps65917_data = { .features = &tps659038_features, .irq_chip = &tps65917_irq_chip, }; @@ -493,12 +493,11 @@ static int palmas_i2c_probe(struct i2c_client *i2c, { struct palmas *palmas; struct palmas_platform_data *pdata; - struct palmas_driver_data *driver_data; + const struct palmas_driver_data *driver_data; struct device_node *node = i2c->dev.of_node; int ret = 0, i; unsigned int reg, addr; int slave; - const struct of_device_id *match; pdata = dev_get_platdata(&i2c->dev); @@ -522,12 +521,9 @@ static int palmas_i2c_probe(struct i2c_client *i2c, palmas->dev = &i2c->dev; palmas->irq = i2c->irq; - match = of_match_device(of_palmas_match_tbl, &i2c->dev); - - if (!match) + driver_data = of_device_get_match_data(&i2c->dev); + if (!driver_data) return -ENODATA; - - driver_data = (struct palmas_driver_data *)match->data; palmas->features = *driver_data->features; for (i = 0; i < PALMAS_NUM_CLIENTS; i++) {