From patchwork Sun Dec 17 15:40:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10117755 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 2F8C960327 for ; Sun, 17 Dec 2017 15:41:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3607E292A1 for ; Sun, 17 Dec 2017 15:41:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B21D293AD; Sun, 17 Dec 2017 15:41:15 +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 B64C6292A1 for ; Sun, 17 Dec 2017 15:41:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753456AbdLQPlA (ORCPT ); Sun, 17 Dec 2017 10:41:00 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:44632 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751812AbdLQPk6 (ORCPT ); Sun, 17 Dec 2017 10:40:58 -0500 Received: by mail-wr0-f196.google.com with SMTP id w95so1033018wrc.11 for ; Sun, 17 Dec 2017 07:40:58 -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:in-reply-to:references; bh=F8N//r1ga04Tj+3JNBeergZuIBcJFYYw0MbrQI8R3V8=; b=HQTcbpfnHWRAYBE0rbApzcuTzfJu4KZoAgKTRwM0GAKYLbJXPFP+I3ooLpHXi0MCE+ wN6wi4e6VuNFdajESxwNSv8kABmVwJsMIDCUWX7UKSFfWPCZ9/HWlAmbMnWiuO1eb20i wa/KYprNk/RtC6VfObRGWf4dxEaqHNHUvEdAYGTPuFKC9hHl7oJESGHzqj2vMUeQmwKu 4KoIn4i9ZZILmFOASL9PIpejFfUPcBjeMi8+Wb7CMHaBfJDdRhSnCPjSFei8ZpVAa+dK nhrW9umsmcjuE8Hk27dR9QUqIEqX/H3+TiOeM7Lzzxa6z9ysrhAPxx3J/tgtm8eH2oEy 4OdQ== 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:in-reply-to :references; bh=F8N//r1ga04Tj+3JNBeergZuIBcJFYYw0MbrQI8R3V8=; b=ZOZg2FYarrrFvQH9Mx6jG5J+eWPTMsTCcmF+e8Cs3lUUHlmIzBGOJortWDh71zPDIH mGZB0x4VW4PO08wSfX6RSIvoYD6XhbCe1rYgeJeF7FGOiKrd5fzNKZf+BqQ2WHO70cll bIx8FQc49LWVs3/Ofw1+FwzcrW2ZgK36T/Lv8bbUImxWkJCgGW7ukQGIkaCFCfGmavrq U1TfJGxaIcWfcyI0CoJEIM1qs1hSFuadSagbz7PMgFAB5jDFRyTgeMWB8bngFyoclKYs v3BLnutgj1CM02g5m+eHsO/QX1RHTwVM5S4K+ZiNsKZWBXd5xXC3BFxWuOJfJR5mJd7i j+BQ== X-Gm-Message-State: AKGB3mL0jpiffPqFVyIDRGVNC0wfGNe0u4mEt5MQFMvJc0EfgpDFOd4C 8czgebXsWi8CeW7GZe/2kL3hIA== X-Google-Smtp-Source: ACJfBosV7TQvUdnTcEL8W42GXlNIUB+rNqDHTqWQ/5sfYQcIZmT3GMJlM+Lz8IdqfuKSw77SObvAQg== X-Received: by 10.223.178.163 with SMTP id g32mr4504106wrd.129.1513525257479; Sun, 17 Dec 2017 07:40:57 -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 m52sm2420974wrm.12.2017.12.17.07.40.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Dec 2017 07:40:56 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: Ralph Metzler Subject: [PATCH 4/8] [media] ddbridge: move CI detach code to ddbridge-ci.c Date: Sun, 17 Dec 2017 16:40:45 +0100 Message-Id: <20171217154049.1125-5-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171217154049.1125-1-d.scheller.oss@gmail.com> References: <20171217154049.1125-1-d.scheller.oss@gmail.com> 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 Move the CI teardown code to ddbridge-ci.c where everything else related to CI hardware lives. Cc: Ralph Metzler Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-ci.c | 11 +++++++++++ drivers/media/pci/ddbridge/ddbridge-ci.h | 1 + drivers/media/pci/ddbridge/ddbridge-core.c | 8 +------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-ci.c b/drivers/media/pci/ddbridge/ddbridge-ci.c index 8dfbc3bbd86d..5828111487b0 100644 --- a/drivers/media/pci/ddbridge/ddbridge-ci.c +++ b/drivers/media/pci/ddbridge/ddbridge-ci.c @@ -346,3 +346,14 @@ int ddb_ci_attach(struct ddb_port *port, u32 bitrate) dvb_ca_en50221_init(port->dvb[0].adap, port->en, 0, 1); return 0; } + +void ddb_ci_detach(struct ddb_port *port) +{ + if (port->dvb[0].dev) + dvb_unregister_device(port->dvb[0].dev); + if (port->en) { + dvb_ca_en50221_release(port->en); + kfree(port->en->data); + port->en = NULL; + } +} diff --git a/drivers/media/pci/ddbridge/ddbridge-ci.h b/drivers/media/pci/ddbridge/ddbridge-ci.h index 3a5d7ffab7b7..35a39182dd83 100644 --- a/drivers/media/pci/ddbridge/ddbridge-ci.h +++ b/drivers/media/pci/ddbridge/ddbridge-ci.h @@ -26,5 +26,6 @@ /******************************************************************************/ int ddb_ci_attach(struct ddb_port *port, u32 bitrate); +void ddb_ci_detach(struct ddb_port *port); #endif /* __DDBRIDGE_CI_H__ */ diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index a81125d492ff..c2f028152388 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -1986,13 +1986,7 @@ void ddb_ports_detach(struct ddb *dev) break; case DDB_PORT_CI: case DDB_PORT_LOOP: - if (port->dvb[0].dev) - dvb_unregister_device(port->dvb[0].dev); - if (port->en) { - dvb_ca_en50221_release(port->en); - kfree(port->en->data); - port->en = NULL; - } + ddb_ci_detach(port); break; } }