From patchwork Mon Aug 21 12:12:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 803985 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xbXfb3Hkxz9rxl for ; Mon, 21 Aug 2017 22:13:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XOHBedcd"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xbXfb22Q5zDrKJ for ; Mon, 21 Aug 2017 22:13:59 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XOHBedcd"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xbXcj4KP3zDrJg for ; Mon, 21 Aug 2017 22:12:21 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XOHBedcd"; dkim-atps=neutral Received: by mail-pg0-x241.google.com with SMTP id t3so3187445pgt.5 for ; Mon, 21 Aug 2017 05:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=owuDdvIGIWFnKW+lI43QGcauT+SPGsue7IkvK8sbNtA=; b=XOHBedcdpKMkaZ1sdz/h/OT8BeaviuvwphfxsNF2s42YRAV2+iA/DarTgLAdRePIbe wjFLY5ztRDVriRSN2xjwPhgyJCMKVlRz/JL58HREay3z4/wBcO37zoKUm/W61P/XRoCY EBnzZdoTPfYWjoZ6NN/IUHTqAWB3It2N1nx9x5nStp0qbkc5kHFqNwQMKA7Dx1AXFIbn KbkLQ6tCTgwaH1r6xQV2uRtdqMZtRyXxZWGq6K8N+wo/7XDPC/Fy2oY8SutSlxthaXs9 4cJlN4n4PgYyXT8/og0vqRbysNGDpfn+6Jj7ttSJnOUJiK3uZtFN/6R878MavZWwqOLO jrIQ== 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=owuDdvIGIWFnKW+lI43QGcauT+SPGsue7IkvK8sbNtA=; b=GXNkZUO7YDJacoWh3JxhMXuGyRjedW3N+7XapYVI+T74rHPHrSFscYtLlCMF7WtcwE JGnyJ9H0X7BBK59MTorICEJDsIgQ9+UsKjuEKTquBZOdLXgfUfijfUy6a1pwEQga35ds agdA7RoilDgzMWjWQJ3Fgb8YJ0gVS/RUwt9u/BYejgVMdUGAW1/hXfNIXk2toxJZn8g2 QVm5qoM0mGaKEDPIX69rXR+qLpdLkoMOylvMNcnzocz7iQpoICtt56RUIocgg4BAvBOT XH1jrNGN4jkD/GKrXyMUbdIuuMvGCl3HlMHeR8joNNLAbkrck/CKJMFEEg9aI7z5lCI2 gKbg== X-Gm-Message-State: AHYfb5hz6kIFZdp+3iES7pJaiDMQd0585DeMhyeJQbB8CDAZpN0tvl4N GrBh/uDYBp1TYA== X-Received: by 10.98.158.133 with SMTP id f5mr1757691pfk.295.1503317539252; Mon, 21 Aug 2017 05:12:19 -0700 (PDT) Received: from gmail.com ([117.196.124.142]) by smtp.gmail.com with ESMTPSA id a21sm14577437pfg.18.2017.08.21.05.12.11 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 21 Aug 2017 05:12:18 -0700 (PDT) Received: by gmail.com (sSMTP sendmail emulation); Mon, 21 Aug 2017 17:42:08 +0530 From: Bhumika Goyal To: julia.lawall@lip6.fr, ludovic.desroches@microchip.com, wsa@the-dreams.de, jochen@scram.de, vadimp@mellanox.com, michaelsh@mellanox.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, andy.gross@linaro.org, david.brown@linaro.org, ldewangan@nvidia.com, thierry.reding@gmail.com, jonathanh@nvidia.com, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH] i2c: busses: make i2c_adapter_quirks const Date: Mon, 21 Aug 2017 17:42:04 +0530 Message-Id: <1503317524-21276-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bhumika Goyal Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Make these const as they are only stored as a reference in the quirks field of an i2c_adapter structure, which is const. Done using Coccinelle: @match disable optional_qualifier@ identifier s; @@ static struct i2c_adapter_quirks s = {...}; @ref@ position p; identifier match.s; @@ s@p @good1@ identifier y; position ref.p; identifier match.s; @@ struct i2c_adapter y = {...,.quirks=&s@p,...}; @good2@ struct i2c_adapter y; identifier match.s; position ref.p; @@ y.quirks = &s@p @bad depends on !good1 && !good2@ position ref.p; identifier match.s; @@ s@p @depends on forall !bad disable optional_qualifier@ identifier match.s; @@ static + const struct i2c_adapter_quirks s; Signed-off-by: Bhumika Goyal --- drivers/i2c/busses/i2c-at91.c | 2 +- drivers/i2c/busses/i2c-cpm.c | 2 +- drivers/i2c/busses/i2c-mlxcpld.c | 2 +- drivers/i2c/busses/i2c-opal.c | 2 +- drivers/i2c/busses/i2c-powermac.c | 2 +- drivers/i2c/busses/i2c-qup.c | 2 +- drivers/i2c/busses/i2c-tegra.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 38dd61d..bfd1fdf 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -809,7 +809,7 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num) * The hardware can handle at most two messages concatenated by a * repeated start via it's internal address feature. */ -static struct i2c_adapter_quirks at91_twi_quirks = { +static const struct i2c_adapter_quirks at91_twi_quirks = { .flags = I2C_AQ_COMB | I2C_AQ_COMB_WRITE_FIRST | I2C_AQ_COMB_SAME_ADDR, .max_comb_1st_msg_len = 3, }; diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index d89bde2..8a8ca94 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c @@ -413,7 +413,7 @@ static u32 cpm_i2c_func(struct i2c_adapter *adap) }; /* CPM_MAX_READ is also limiting writes according to the code! */ -static struct i2c_adapter_quirks cpm_i2c_quirks = { +static const struct i2c_adapter_quirks cpm_i2c_quirks = { .max_num_msgs = CPM_MAXBD, .max_read_len = CPM_MAX_READ, .max_write_len = CPM_MAX_READ, diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c index d271e6a..4c28fa2 100644 --- a/drivers/i2c/busses/i2c-mlxcpld.c +++ b/drivers/i2c/busses/i2c-mlxcpld.c @@ -433,7 +433,7 @@ static u32 mlxcpld_i2c_func(struct i2c_adapter *adap) .functionality = mlxcpld_i2c_func }; -static struct i2c_adapter_quirks mlxcpld_i2c_quirks = { +static const struct i2c_adapter_quirks mlxcpld_i2c_quirks = { .flags = I2C_AQ_COMB_WRITE_THEN_READ, .max_read_len = MLXCPLD_I2C_DATA_REG_SZ - MLXCPLD_I2C_MAX_ADDR_LEN, .max_write_len = MLXCPLD_I2C_DATA_REG_SZ, diff --git a/drivers/i2c/busses/i2c-opal.c b/drivers/i2c/busses/i2c-opal.c index 11e2a1f..0aabb7e 100644 --- a/drivers/i2c/busses/i2c-opal.c +++ b/drivers/i2c/busses/i2c-opal.c @@ -204,7 +204,7 @@ static u32 i2c_opal_func(struct i2c_adapter *adapter) * For two messages, we basically support simple smbus transactions of a * write-then-anything. */ -static struct i2c_adapter_quirks i2c_opal_quirks = { +static const struct i2c_adapter_quirks i2c_opal_quirks = { .flags = I2C_AQ_COMB | I2C_AQ_COMB_WRITE_FIRST | I2C_AQ_COMB_SAME_ADDR, .max_comb_1st_msg_len = 4, }; diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index ef9c858..f2a2067 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c @@ -197,7 +197,7 @@ static u32 i2c_powermac_func(struct i2c_adapter * adapter) .functionality = i2c_powermac_func, }; -static struct i2c_adapter_quirks i2c_powermac_quirks = { +static const struct i2c_adapter_quirks i2c_powermac_quirks = { .max_num_msgs = 1, }; diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index 1902d8a..08f8e01 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -1396,7 +1396,7 @@ static u32 qup_i2c_func(struct i2c_adapter *adap) * the end of the read, the length of the read is specified as one byte * which limits the possible read to 256 (QUP_READ_LIMIT) bytes. */ -static struct i2c_adapter_quirks qup_i2c_quirks = { +static const struct i2c_adapter_quirks qup_i2c_quirks = { .max_read_len = QUP_READ_LIMIT, }; diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index a238844..60292d2 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -793,7 +793,7 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev *i2c_dev) }; /* payload size is only 12 bit */ -static struct i2c_adapter_quirks tegra_i2c_quirks = { +static const struct i2c_adapter_quirks tegra_i2c_quirks = { .max_read_len = 4096, .max_write_len = 4096, };