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: 790352 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4H3KiSb023285 for ; Tue, 17 May 2011 03:20:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751758Ab1EQDUd (ORCPT ); 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 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 17 May 2011 03:20:45 +0000 (UTC) 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