From patchwork Tue May 17 04:23:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitri Belimov X-Patchwork-Id: 6617 Return-path: Envelope-to: mchehab@pedra Delivery-date: Tue, 17 May 2011 07:22:38 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1QMHQE-0006kA-01 for mchehab@pedra; Tue, 17 May 2011 07:22:38 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Tue, 17 May 2011 07:22:37 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QMAq3-0002RP-3B; Tue, 17 May 2011 03:20:51 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751758Ab1EQDUd (ORCPT + 1 other); Mon, 16 May 2011 23:20:33 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:57844 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751582Ab1EQDUc (ORCPT ); Mon, 16 May 2011 23:20:32 -0400 Received: by bwz15 with SMTP id 15so155766bwz.19 for ; Mon, 16 May 2011 20:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:subject:message-id:x-mailer :mime-version:content-type; bh=ZvWM6j6kIbXvqlVoES9LS3PvgAqz8nNmHVaE2RRg3PA=; b=LQiIC6OsbpydVV9+xertij9PzW2ogFTgfOSAR04lho1n6VUOHDQyJimjeyPlJYY3CH ooFPsKyiQoqq2yQU3uApVe87zLKOCd1aT5QfkvUxrsA+mr/XQxbSGVmcWSZSU7r7zLBD eyR2kxQuyIyyJCT82PnzRaHhRHzZZQiB5YGtI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:x-mailer:mime-version:content-type; b=GIox8Ybcp86QRtkWUeTTy6FiyK5C/GCnptA7WKNtzeE+Yg7OW3PoLbCKxnjU4J0zjT YW/unuc8NyPVlnLxqumkZ3qCBkfZ/meUzLa5fLTPTekXdczJxhL4ak03BT/CHOT9SMjQ K9hxzrxNFXDt2Hgsh/mE/jvggLvQcX447LSA0= Received: by 10.204.154.194 with SMTP id p2mr126895bkw.58.1305602431264; Mon, 16 May 2011 20:20:31 -0700 (PDT) Received: from glory.local ([83.234.160.236]) by mx.google.com with ESMTPS id a28sm1052509fak.3.2011.05.16.20.20.29 (version=SSLv3 cipher=OTHER); Mon, 16 May 2011 20:20:30 -0700 (PDT) Date: Tue, 17 May 2011 14:23:52 +1000 From: Dmitri Belimov To: Linux Media Mailing List , Mauro Carvalho Chehab Subject: [PATCH] xc5000, fix fw upload crash Message-ID: <20110517142352.7d311ee8@glory.local> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i486-pc-linux-gnu) Mime-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Hi Fix crash when init tuner and upload twice the firmware into xc5000 at the some time. Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov With my best regards, Dmitry. diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index aa1b2e8..a491a5b 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c @@ -996,6 +996,8 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe) struct xc5000_priv *priv = fe->tuner_priv; int ret = 0; + mutex_lock(&xc5000_list_mutex); + if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { ret = xc5000_fwupload(fe); if (ret != XC_RESULT_SUCCESS) @@ -1015,6 +1017,8 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe) /* Default to "CABLE" mode */ ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE); + mutex_unlock(&xc5000_list_mutex); + return ret; } Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov