From patchwork Mon May 6 15:44:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gianluca Gennari X-Patchwork-Id: 18306 X-Patchwork-Delegate: mkrufky@linuxtv.org Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1UZNbP-0003N4-KU; Mon, 06 May 2013 17:45:23 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-6) with esmtp id 1UZNbN-00084G-5j; Mon, 06 May 2013 17:45:23 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755396Ab3EFPpS (ORCPT + 1 other); Mon, 6 May 2013 11:45:18 -0400 Received: from mail-ea0-f181.google.com ([209.85.215.181]:44333 "EHLO mail-ea0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755384Ab3EFPpQ (ORCPT ); Mon, 6 May 2013 11:45:16 -0400 Received: by mail-ea0-f181.google.com with SMTP id a11so1763066eae.12 for ; Mon, 06 May 2013 08:45:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=RSYEN+YRu4RhsCWPnlQLvYluTfoCYPR3nQS7tJB9vqs=; b=NaIYK+wD3GpwyhEUPd1EGTjBEcS6F5oYmfivDMLjMt7KNyZt0vbdMGWTe5c/QCI2Rg 6cTuMyitg/cZ/BeA/i/Dvr3zmA4l+qpVja3adowEOiJKmmLHxI25lbBNubxECt8AWNmN AZK2Tw1RkBLi6b1X7YpEXMzK0cD5gKjqiNP8TgHj2DQ09p9jJwJNV/c1dI45Dh02KQdB CdLNqbaD0Romlz1B+G+Dv9Sj74I0JQw1uxcI3W2ncO9hO2lisKFkdJ7vMJyPREhSIurk 0w2nuwRGQeUCyCoJ1lm53mjBo3GKoQzDJDVz2PXoH7qykt9niAbZLAx9u+Pij/yGPb6A ZX+Q== X-Received: by 10.14.105.1 with SMTP id j1mr61655465eeg.6.1367855114815; Mon, 06 May 2013 08:45:14 -0700 (PDT) Received: from localhost.localdomain (93-50-34-119.ip150.fastwebnet.it. [93.50.34.119]) by mx.google.com with ESMTPSA id x41sm25331914eey.17.2013.05.06.08.45.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 06 May 2013 08:45:14 -0700 (PDT) From: Gianluca Gennari To: linux-media@vger.kernel.org, mchehab@redhat.com Cc: Gianluca Gennari Subject: [PATCH 2/3] r820t: remove redundant initializations in r820t_attach() Date: Mon, 6 May 2013 17:44:36 +0200 Message-Id: <1367855077-6134-3-git-send-email-gennarone@gmail.com> X-Mailer: git-send-email 1.8.2.2 In-Reply-To: <1367855077-6134-1-git-send-email-gennarone@gmail.com> References: <1367855077-6134-1-git-send-email-gennarone@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.5.6.153317 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' FORGED_FROM_GMAIL 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1400_1499 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' fe->tuner_priv and fe->ops.tuner_ops are initialized twice in r820t_attach(). Remove the redundant initializations and also move fe->ops.tuner_ops initialization outside of the mutex lock (as in the xc4000 tuner code for example). Signed-off-by: Gianluca Gennari --- drivers/media/tuners/r820t.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c index 4835021..d8fd16a 100644 --- a/drivers/media/tuners/r820t.c +++ b/drivers/media/tuners/r820t.c @@ -2311,8 +2311,6 @@ struct dvb_frontend *r820t_attach(struct dvb_frontend *fe, break; } - memcpy(&fe->ops.tuner_ops, &r820t_tuner_ops, sizeof(r820t_tuner_ops)); - if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); @@ -2327,15 +2325,14 @@ struct dvb_frontend *r820t_attach(struct dvb_frontend *fe, tuner_info("Rafael Micro r820t successfully identified\n"); - fe->tuner_priv = priv; - memcpy(&fe->ops.tuner_ops, &r820t_tuner_ops, - sizeof(struct dvb_tuner_ops)); - if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); mutex_unlock(&r820t_list_mutex); + memcpy(&fe->ops.tuner_ops, &r820t_tuner_ops, + sizeof(struct dvb_tuner_ops)); + return fe; err: if (fe->ops.i2c_gate_ctrl)