From patchwork Mon Mar 3 10:06:47 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: 3753311 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 7350CBF13A for ; Mon, 3 Mar 2014 10:15:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C22E20396 for ; Mon, 3 Mar 2014 10:15:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17B2920395 for ; Mon, 3 Mar 2014 10:15:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754520AbaCCKPn (ORCPT ); Mon, 3 Mar 2014 05:15:43 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:49351 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754094AbaCCKHz (ORCPT ); Mon, 3 Mar 2014 05:07:55 -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 1WKPmp-00078O-Et; Mon, 03 Mar 2014 10:07:52 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.80.1) (envelope-from ) id 1WKPmF-0006Xw-GU; 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 53/79] [media] drx-j: get rid of the remaining drx generic functions Date: Mon, 3 Mar 2014 07:06:47 -0300 Message-Id: <1393841233-24840-54-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 Get rid of drx_open and drx_close, as those are just wrapper functions to drxj_open/drxj_close. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/drx39xyj/drx39xxj.c | 2 +- drivers/media/dvb-frontends/drx39xyj/drx_driver.h | 25 ----- drivers/media/dvb-frontends/drx39xyj/drxj.c | 108 +++++----------------- 3 files changed, 23 insertions(+), 112 deletions(-) diff --git a/drivers/media/dvb-frontends/drx39xyj/drx39xxj.c b/drivers/media/dvb-frontends/drx39xyj/drx39xxj.c index 7e316618bfa9..aae9e7c24d5f 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drx39xxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drx39xxj.c @@ -413,7 +413,7 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c) demod->my_tuner = NULL; demod->i2c = i2c; - result = drx_open(demod); + result = drxj_open(demod); if (result != 0) { pr_err("DRX open failed! Aborting\n"); goto error; diff --git a/drivers/media/dvb-frontends/drx39xyj/drx_driver.h b/drivers/media/dvb-frontends/drx39xyj/drx_driver.h index 9ecf01029e90..b9ba48f88523 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drx_driver.h +++ b/drivers/media/dvb-frontends/drx39xyj/drx_driver.h @@ -2013,28 +2013,11 @@ struct drx_reg_dump { struct drx_demod_instance; - typedef int(*drx_open_func_t) (struct drx_demod_instance *demod); - typedef int(*drx_close_func_t) (struct drx_demod_instance *demod); - typedef int(*drx_ctrl_func_t) (struct drx_demod_instance *demod, - u32 ctrl, - void *ctrl_data); - -/** -* \struct struct drx_demod_func * \brief A stucture containing all functions of a demodulator. -*/ - struct drx_demod_func { - u32 type_id; /**< Device type identifier. */ - drx_open_func_t open_func; /**< Pointer to Open() function. */ - drx_close_func_t close_func;/**< Pointer to Close() function. */ - drx_ctrl_func_t ctrl_func; /**< Pointer to Ctrl() function. */}; - /** * \struct struct drx_demod_instance * \brief Top structure of demodulator instance. */ struct drx_demod_instance { /* type specific demodulator data */ - struct drx_demod_func *my_demod_funct; - /**< demodulator functions */ struct drx_access_func *my_access_funct; /**< data access protocol functions */ struct tuner_instance *my_tuner; @@ -2461,14 +2444,6 @@ Access macros #define DRX_ISDVBTSTD(std) ((std) == DRX_STANDARD_DVBT) /*------------------------------------------------------------------------- -Exported FUNCTIONS --------------------------------------------------------------------------*/ - - int drx_open(struct drx_demod_instance *demod); - - int drx_close(struct drx_demod_instance *demod); - -/*------------------------------------------------------------------------- THE END -------------------------------------------------------------------------*/ #endif /* __DRXDRIVER_H__ */ diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index 083673525243..9bcd24b77076 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -586,17 +586,6 @@ struct drx_access_func drx_dap_drxj_funct_g = { drxj_dap_read_modify_write_reg32, /* Not supported */ }; -/** -* /var DRXJ_Func_g -* /brief The driver functions of the drxj -*/ -struct drx_demod_func drxj_functions_g = { - DRXJ_TYPE_ID, - drxj_open, - drxj_close, - drxj_ctrl -}; - struct drxj_data drxj_data_g = { false, /* has_lna : true if LNA (aka PGA) present */ false, /* has_oob : true if OOB supported */ @@ -927,7 +916,6 @@ struct drx_common_attr drxj_default_comm_attr_g = { * \brief Default drxj demodulator instance. */ struct drx_demod_instance drxj_default_demod_g = { - &drxj_functions_g, /* demod functions */ &DRXJ_DAP, /* data access protocol functions */ NULL, /* tuner instance */ &drxj_default_addr_g, /* i2c address & device id */ @@ -19822,6 +19810,15 @@ int drxj_open(struct drx_demod_instance *demod) struct drx_cfg_mpeg_output cfg_mpeg_output; int rc; + + if ((demod == NULL) || + (demod->my_common_attr == NULL) || + (demod->my_ext_attr == NULL) || + (demod->my_i2c_dev_addr == NULL) || + (demod->my_common_attr->is_opened)) { + return -EINVAL; + } + /* Check arguments */ if (demod->my_ext_attr == NULL) return -EINVAL; @@ -20020,6 +20017,7 @@ int drxj_open(struct drx_demod_instance *demod) /* refresh the audio data structure with default */ ext_attr->aud_data = drxj_default_aud_data_g; + demod->my_common_attr->is_opened = true; return 0; rw_error: common_attr->is_opened = false; @@ -20040,6 +20038,14 @@ int drxj_close(struct drx_demod_instance *demod) int rc; enum drx_power_mode power_mode = DRX_POWER_UP; + if ((demod == NULL) || + (demod->my_common_attr == NULL) || + (demod->my_ext_attr == NULL) || + (demod->my_i2c_dev_addr == NULL) || + (!demod->my_common_attr->is_opened)) { + return -EINVAL; + } + /* power up */ rc = ctrl_power_mode(demod, &power_mode); if (rc != 0) { @@ -20084,8 +20090,12 @@ int drxj_close(struct drx_demod_instance *demod) goto rw_error; } + DRX_ATTR_ISOPENED(demod) = false; + return 0; rw_error: + DRX_ATTR_ISOPENED(demod) = false; + return -EIO; } @@ -20578,77 +20588,3 @@ release: return rc; } - -/*============================================================================*/ - -/* - * Exported functions - */ - -/** - * drx_open - Open a demodulator instance. - * @demod: A pointer to a demodulator instance. - * - * This function returns: - * 0: Opened demod instance with succes. - * -EIO: Driver not initialized or unable to initialize - * demod. - * -EINVAL: Demod instance has invalid content. - * - */ - -int drx_open(struct drx_demod_instance *demod) -{ - int status = 0; - - if ((demod == NULL) || - (demod->my_demod_funct == NULL) || - (demod->my_common_attr == NULL) || - (demod->my_ext_attr == NULL) || - (demod->my_i2c_dev_addr == NULL) || - (demod->my_common_attr->is_opened)) { - return -EINVAL; - } - - status = (*(demod->my_demod_funct->open_func)) (demod); - - if (status == 0) - demod->my_common_attr->is_opened = true; - - return status; -} - -/*============================================================================*/ - -/** - * drx_close - Close device - * @demod: A pointer to a demodulator instance. - * - * Free resources occupied by device instance. - * Put device into sleep mode. - * - * This function returns: - * 0: Closed demod instance with succes. - * -EIO: Driver not initialized or error during close - * demod. - * -EINVAL: Demod instance has invalid content. - */ -int drx_close(struct drx_demod_instance *demod) -{ - int status = 0; - - if ((demod == NULL) || - (demod->my_demod_funct == NULL) || - (demod->my_common_attr == NULL) || - (demod->my_ext_attr == NULL) || - (demod->my_i2c_dev_addr == NULL) || - (!demod->my_common_attr->is_opened)) { - return -EINVAL; - } - - status = (*(demod->my_demod_funct->close_func)) (demod); - - DRX_ATTR_ISOPENED(demod) = false; - - return status; -}