From patchwork Sat Nov 26 18:13:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolae Rosia X-Patchwork-Id: 9448481 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 0A9956071C for ; Sat, 26 Nov 2016 18:17:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3A7926419 for ; Sat, 26 Nov 2016 18:17:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E86C926C9B; Sat, 26 Nov 2016 18:17:43 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 93A9726419 for ; Sat, 26 Nov 2016 18:17:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753755AbcKZSO2 (ORCPT ); Sat, 26 Nov 2016 13:14:28 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:33175 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753444AbcKZSOY (ORCPT ); Sat, 26 Nov 2016 13:14:24 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1cAhUP-0003N8-AB from Nicolae_Rosia@mentor.com ; Sat, 26 Nov 2016 10:14:17 -0800 Received: from rosia.mgc (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Sat, 26 Nov 2016 18:14:15 +0000 From: Nicolae Rosia To: Lee Jones , Mark Brown , Rob Herring , Mark Rutland , Tony Lindgren CC: Liam Girdwood , Paul Gortmaker , Graeme Gregory , Baruch Siach , , , , , Nicolae Rosia Subject: [PATCH 3/5] mfd: twl: move structure definitions to a public header Date: Sat, 26 Nov 2016 20:13:24 +0200 Message-ID: <20161126181326.14951-4-Nicolae_Rosia@mentor.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161126181326.14951-1-Nicolae_Rosia@mentor.com> References: <20161126181326.14951-1-Nicolae_Rosia@mentor.com> MIME-Version: 1.0 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 We want to get rid of exported symbols and have the child devices use structure members directly. Move the structure definitions to header and set drvdata so child devices can access it. Signed-off-by: Nicolae Rosia --- drivers/mfd/twl-core.c | 27 ++++----------------------- include/linux/mfd/twl-core.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 23 deletions(-) create mode 100644 include/linux/mfd/twl-core.h diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index e16084e..409b836 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -48,6 +48,7 @@ #include #include +#include /* Register descriptions for audio */ #include @@ -154,28 +155,7 @@ int twl4030_init_irq(struct device *dev, int irq_num); int twl4030_exit_irq(void); int twl4030_init_chip_irq(const char *chip); -/* Structure for each TWL4030/TWL6030 Slave */ -struct twl_client { - struct i2c_client *client; - struct regmap *regmap; -}; - -/* mapping the module id to slave id and base address */ -struct twl_mapping { - unsigned char sid; /* Slave ID */ - unsigned char base; /* base address */ -}; - -struct twl_private { - bool ready; /* The core driver is ready to be used */ - u32 twl_idcode; /* TWL IDCODE Register value */ - unsigned int twl_id; - - struct twl_mapping *twl_map; - struct twl_client *twl_modules; -}; - -static struct twl_private *twl_priv; +static struct twlcore *twl_priv; static struct twl_mapping twl4030_map[] = { /* @@ -745,7 +725,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) goto free; } - twl_priv = devm_kzalloc(&client->dev, sizeof(struct twl_private), + twl_priv = devm_kzalloc(&client->dev, sizeof(struct twlcore), GFP_KERNEL); if (!twl_priv) { status = -ENOMEM; @@ -803,6 +783,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) } twl_priv->ready = true; + dev_set_drvdata(&client->dev, twl_priv); /* setup clock framework */ clocks_init(&pdev->dev); diff --git a/include/linux/mfd/twl-core.h b/include/linux/mfd/twl-core.h new file mode 100644 index 0000000..d1c01b3 --- /dev/null +++ b/include/linux/mfd/twl-core.h @@ -0,0 +1,35 @@ +/* + * MFD core driver for the Texas Instruments TWL PMIC family + * + * Copyright (C) 2016 Nicolae Rosia + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __TWL_CORE_H__ +#define __TWL_CORE_H__ + +/* Structure for each TWL4030/TWL6030 Slave */ +struct twl_client { + struct i2c_client *client; + struct regmap *regmap; +}; + +/* mapping the module id to slave id and base address */ +struct twl_mapping { + unsigned char sid; /* Slave ID */ + unsigned char base; /* base address */ +}; + +struct twlcore { + bool ready; /* The core driver is ready to be used */ + u32 twl_idcode; /* TWL IDCODE Register value */ + unsigned int twl_id; + + struct twl_mapping *twl_map; + struct twl_client *twl_modules; +}; + +#endif