From patchwork Mon Mar 3 10:07:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 3753101 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 382FDBF13A for ; Mon, 3 Mar 2014 10:14:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11C8E203A9 for ; Mon, 3 Mar 2014 10:14:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9F4AC20394 for ; Mon, 3 Mar 2014 10:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754665AbaCCKO3 (ORCPT ); Mon, 3 Mar 2014 05:14:29 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:49445 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754201AbaCCKIE (ORCPT ); Mon, 3 Mar 2014 05:08:04 -0500 Received: from [201.74.152.26] (helo=smtp.w2.samsung.com) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKPmz-00078I-IC; Mon, 03 Mar 2014 10:08:02 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.80.1) (envelope-from ) id 1WKPmF-0006Yz-Kk; Mon, 03 Mar 2014 07:07:15 -0300 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab Subject: [PATCH 66/79] [media] drx-j: get rid of function prototypes at drx_dap_fasi.c Date: Mon, 3 Mar 2014 07:07:00 -0300 Message-Id: <1393841233-24840-67-git-send-email-m.chehab@samsung.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1393841233-24840-1-git-send-email-m.chehab@samsung.com> References: <1393841233-24840-1-git-send-email-m.chehab@samsung.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reorder functions and data at drx_dap_fasi.c, in order to avoid having function prototypes. This is in preparation to merge this code inside drxj, removing some duplicated bits there, and getting rid of yet another abstraction layer. Signed-off-by: Mauro Carvalho Chehab --- .../media/dvb-frontends/drx39xyj/drx_dap_fasi.c | 178 +++++++-------------- 1 file changed, 59 insertions(+), 119 deletions(-) diff --git a/drivers/media/dvb-frontends/drx39xyj/drx_dap_fasi.c b/drivers/media/dvb-frontends/drx39xyj/drx_dap_fasi.c index b81b4f9cd4b0..3e456ba780eb 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drx_dap_fasi.c +++ b/drivers/media/dvb-frontends/drx39xyj/drx_dap_fasi.c @@ -47,82 +47,6 @@ /*============================================================================*/ -/* Function prototypes */ -static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, /* address of I2C device */ - u32 addr, /* address of register/memory */ - u16 datasize, /* size of data */ - u8 *data, /* data to send */ - u32 flags); /* special device flags */ - -static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, /* address of I2C device */ - u32 addr, /* address of register/memory */ - u16 datasize, /* size of data */ - u8 *data, /* data to send */ - u32 flags); /* special device flags */ - -static int drxdap_fasi_write_reg8(struct i2c_device_addr *dev_addr, /* address of I2C device */ - u32 addr, /* address of register */ - u8 data, /* data to write */ - u32 flags); /* special device flags */ - -static int drxdap_fasi_read_reg8(struct i2c_device_addr *dev_addr, /* address of I2C device */ - u32 addr, /* address of register */ - u8 *data, /* buffer to receive data */ - u32 flags); /* special device flags */ - -static int drxdap_fasi_read_modify_write_reg8(struct i2c_device_addr *dev_addr, /* address of I2C device */ - u32 waddr, /* address of register */ - u32 raddr, /* address to read back from */ - u8 datain, /* data to send */ - u8 *dataout); /* data to receive back */ - -static int drxdap_fasi_write_reg16(struct i2c_device_addr *dev_addr, /* address of I2C device */ - u32 addr, /* address of register */ - u16 data, /* data to write */ - u32 flags); /* special device flags */ - -static int drxdap_fasi_read_reg16(struct i2c_device_addr *dev_addr, /* address of I2C device */ - u32 addr, /* address of register */ - u16 *data, /* buffer to receive data */ - u32 flags); /* special device flags */ - -static int drxdap_fasi_read_modify_write_reg16(struct i2c_device_addr *dev_addr, /* address of I2C device */ - u32 waddr, /* address of register */ - u32 raddr, /* address to read back from */ - u16 datain, /* data to send */ - u16 *dataout); /* data to receive back */ - -static int drxdap_fasi_write_reg32(struct i2c_device_addr *dev_addr, /* address of I2C device */ - u32 addr, /* address of register */ - u32 data, /* data to write */ - u32 flags); /* special device flags */ - -static int drxdap_fasi_read_reg32(struct i2c_device_addr *dev_addr, /* address of I2C device */ - u32 addr, /* address of register */ - u32 *data, /* buffer to receive data */ - u32 flags); /* special device flags */ - -static int drxdap_fasi_read_modify_write_reg32(struct i2c_device_addr *dev_addr, /* address of I2C device */ - u32 waddr, /* address of register */ - u32 raddr, /* address to read back from */ - u32 datain, /* data to send */ - u32 *dataout); /* data to receive back */ - -/* The structure containing the protocol interface */ -struct drx_access_func drx_dap_fasi_funct_g = { - drxdap_fasi_write_block, /* Supported */ - drxdap_fasi_read_block, /* Supported */ - drxdap_fasi_write_reg8, /* Not supported */ - drxdap_fasi_read_reg8, /* Not supported */ - drxdap_fasi_read_modify_write_reg8, /* Not supported */ - drxdap_fasi_write_reg16, /* Supported */ - drxdap_fasi_read_reg16, /* Supported */ - drxdap_fasi_read_modify_write_reg16, /* Supported */ - drxdap_fasi_write_reg32, /* Supported */ - drxdap_fasi_read_reg32, /* Supported */ - drxdap_fasi_read_modify_write_reg32 /* Not supported */ -}; - /*============================================================================*/ /* Functions not supported by protocol*/ @@ -346,49 +270,6 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, return rc; } -/****************************** -* -* int drxdap_fasi_read_modify_write_reg16 ( -* struct i2c_device_addr *dev_addr, -- address of I2C device -* u32 waddr, -- address of chip register/memory -* u32 raddr, -- chip address to read back from -* u16 wdata, -- data to send -* u16 *rdata) -- data to receive back -* -* Write 16-bit data, then read back the original contents of that location. -* Requires long addressing format to be allowed. -* -* Before sending data, the data is converted to little endian. The -* data received back is converted back to the target platform's endianness. -* -* WARNING: This function is only guaranteed to work if there is one -* master on the I2C bus. -* -* Output: -* - 0 if reading was successful -* in that case: read back data is at *rdata -* - -EIO if anything went wrong -* -******************************/ - -static int drxdap_fasi_read_modify_write_reg16(struct i2c_device_addr *dev_addr, - u32 waddr, - u32 raddr, - u16 wdata, u16 *rdata) -{ - int rc = -EIO; - -#if (DRXDAPFASI_LONG_ADDR_ALLOWED == 1) - if (rdata == NULL) - return -EINVAL; - - rc = drxdap_fasi_write_reg16(dev_addr, waddr, wdata, DRXDAP_FASI_RMW); - if (rc == 0) - rc = drxdap_fasi_read_reg16(dev_addr, raddr, rdata, 0); -#endif - - return rc; -} /****************************** * @@ -628,6 +509,50 @@ static int drxdap_fasi_write_reg16(struct i2c_device_addr *dev_addr, /****************************** * +* int drxdap_fasi_read_modify_write_reg16 ( +* struct i2c_device_addr *dev_addr, -- address of I2C device +* u32 waddr, -- address of chip register/memory +* u32 raddr, -- chip address to read back from +* u16 wdata, -- data to send +* u16 *rdata) -- data to receive back +* +* Write 16-bit data, then read back the original contents of that location. +* Requires long addressing format to be allowed. +* +* Before sending data, the data is converted to little endian. The +* data received back is converted back to the target platform's endianness. +* +* WARNING: This function is only guaranteed to work if there is one +* master on the I2C bus. +* +* Output: +* - 0 if reading was successful +* in that case: read back data is at *rdata +* - -EIO if anything went wrong +* +******************************/ + +static int drxdap_fasi_read_modify_write_reg16(struct i2c_device_addr *dev_addr, + u32 waddr, + u32 raddr, + u16 wdata, u16 *rdata) +{ + int rc = -EIO; + +#if (DRXDAPFASI_LONG_ADDR_ALLOWED == 1) + if (rdata == NULL) + return -EINVAL; + + rc = drxdap_fasi_write_reg16(dev_addr, waddr, wdata, DRXDAP_FASI_RMW); + if (rc == 0) + rc = drxdap_fasi_read_reg16(dev_addr, raddr, rdata, 0); +#endif + + return rc; +} + +/****************************** +* * int drxdap_fasi_write_reg32 ( * struct i2c_device_addr *dev_addr, -- address of I2C device * u32 addr, -- address of chip register/memory @@ -656,3 +581,18 @@ static int drxdap_fasi_write_reg32(struct i2c_device_addr *dev_addr, return drxdap_fasi_write_block(dev_addr, addr, sizeof(data), buf, flags); } + +/* The structure containing the protocol interface */ +struct drx_access_func drx_dap_fasi_funct_g = { + drxdap_fasi_write_block, /* Supported */ + drxdap_fasi_read_block, /* Supported */ + drxdap_fasi_write_reg8, /* Not supported */ + drxdap_fasi_read_reg8, /* Not supported */ + drxdap_fasi_read_modify_write_reg8, /* Not supported */ + drxdap_fasi_write_reg16, /* Supported */ + drxdap_fasi_read_reg16, /* Supported */ + drxdap_fasi_read_modify_write_reg16, /* Supported */ + drxdap_fasi_write_reg32, /* Supported */ + drxdap_fasi_read_reg32, /* Supported */ + drxdap_fasi_read_modify_write_reg32 /* Not supported */ +};