From patchwork Mon Dec 11 20:12:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10105751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9499560751 for ; Mon, 11 Dec 2017 20:12:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82C0E29896 for ; Mon, 11 Dec 2017 20:12:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74E522989A; Mon, 11 Dec 2017 20:12:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDCC729896 for ; Mon, 11 Dec 2017 20:12:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751347AbdLKUMz (ORCPT ); Mon, 11 Dec 2017 15:12:55 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:38841 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750886AbdLKUMy (ORCPT ); Mon, 11 Dec 2017 15:12:54 -0500 Received: by mail-wm0-f68.google.com with SMTP id 64so16413285wme.3 for ; Mon, 11 Dec 2017 12:12:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=f9S3iSrI3dTgSWTV6amhn1Gf8AtRmi+I9z/N3cFSOC4=; b=ZUY8mR2bQykdlrVHNEH90xyOK6KmLGLoQ9FaIbA57T/CJhWIV36JphoX3/o35cbHQ9 KfPYVp7BuiCKSLTvA1AlrEIn4s2wJwbmevVmyoTmktVz9/eXYpdrFlnJ72/LfQvVUpnO a4PKx6YjtQMwn50M/dr/WghOAqmn0Zr7cKoRdMftoTGi4KxTz3se5gAJoco9L5QJWaSh xFVNjtD0s9PGMSvlhnOSPIPiPu/fOyagI2pSt0bRjGJ00i/ITQUtwD6jbjFTi8oos3TU zougZB6wtiKn81C1oQn/x+wl+7/ipktxijuQCCMDr9JzmHdX7YBvrF/+AJlczhLqGCHx C3dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=f9S3iSrI3dTgSWTV6amhn1Gf8AtRmi+I9z/N3cFSOC4=; b=IB+cEu2+D+qayl75OG/KnyRUjDSwqLlkaUGN+rkj8BFHkN7uwFa0d8dMyzFRef+GES pQRESpnv5Iyrj5ERBmT2htlB6XBHFGlHxbCM3inokwiaJyucAj9XG4rR36Xq7pq78ZoA 11K/xMEibBwyxPEc331aIOHInHzK6hbB8DeYcHUi87ZxgVXFvJCSxgSq7N4jArJz+ZrR Sl8UWXtiw2dPevw+ETRfLZuuVqmamjyqWYozLt+rNSq9dwZR9f1btljsIuu4AXr3wHhE QSkl/4qlDvrRBKBBhJ/ZU+TSUY+6cwhPnpT07POdgEPN+J8NlIZ7s94TgzkKeBGq1D6p vY6Q== X-Gm-Message-State: AKGB3mIBv8L9VNhji0fc+Oo+6j1LAd40Z7oIu6mFlDrfsTD2psuaAzPr Z301ADivEl7dcaMR+s/yH7y4yQ== X-Google-Smtp-Source: ACJfBotM2hNYK2sqbRgzrdJdqIVIK7a/65H5Iho1VqSbxRTQxlw1eojg8PSZHx/vWMz4t68bIyfrtg== X-Received: by 10.28.212.204 with SMTP id l195mr1756124wmg.23.1513023173029; Mon, 11 Dec 2017 12:12:53 -0800 (PST) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id x133sm11438828wmd.44.2017.12.11.12.12.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 12:12:52 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: rascobie@slingshot.co.nz Subject: [PATCH] [media] ddbridge: stv09xx: detach frontends on lnb failure Date: Mon, 11 Dec 2017 21:12:49 +0100 Message-Id: <20171211201249.10095-1-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.6 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Scheller While the failure handling in dvb_input_attach() has been improved lately so any tuner failure won't result in demod driver modules with a usecount > 0 anymore (thus requiring rmmod -f), there's still an issue with stv090x and stv0910 based tuner modules, in that LNB driver attach failures leave an attached demod frontend driver behind which have a usecount of > 0 in this failure case, due to them not being detached/ released. Fix this by detaching the demod frontends if the LNB driver fails. Richard tested and verified the changes with STV0910 hardware, thus adding his Tested-by. Signed-off-by: Daniel Scheller Tested-by: Richard Scobie --- drivers/media/pci/ddbridge/ddbridge-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 348cc8b3d1f9..f4d6e43aa0f0 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -1114,6 +1114,7 @@ static int demod_attach_stv0900(struct ddb_input *input, int type) 0, (input->nr & 1) ? (0x09 - type) : (0x0b - type))) { dev_err(dev, "No LNBH24 found!\n"); + dvb_frontend_detach(dvb->fe); return -ENODEV; } return 0; @@ -1196,6 +1197,7 @@ static int demod_attach_stv0910(struct ddb_input *input, int type) lnbcfg.i2c_address = (((input->nr & 1) ? 0x09 : 0x08) << 1); if (!dvb_attach(lnbh25_attach, dvb->fe, &lnbcfg, i2c)) { dev_err(dev, "No LNBH25 found!\n"); + dvb_frontend_detach(dvb->fe); return -ENODEV; } }