From patchwork Mon Mar 16 17:14:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 6023191 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2CA3D9F2A9 for ; Mon, 16 Mar 2015 17:14:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2600A20437 for ; Mon, 16 Mar 2015 17:14:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F7C220439 for ; Mon, 16 Mar 2015 17:14:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933574AbbCPROm (ORCPT ); Mon, 16 Mar 2015 13:14:42 -0400 Received: from mail-lb0-f178.google.com ([209.85.217.178]:34262 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932398AbbCPROl (ORCPT ); Mon, 16 Mar 2015 13:14:41 -0400 Received: by lbbsy1 with SMTP id sy1so35732571lbb.1 for ; Mon, 16 Mar 2015 10:14:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=2vSdMapqZZqW+P71z+jKeEeWfCII1VHMpjaBX1gzsJg=; b=bL4LX6aRZESYNzZ0i8znMvGr2l1ZKpHL3ZuUUmSoo//QzDuwyaO19lIk6Q7KXf/KNv kvXWtfncM0Di34AbTYX+k5auVTUl44LLyZxhclZAwKf7ybb1WGxnA2YnkXVdtolk6xNh E2GJoQrTOYD064KOjJFnTxGaqehEFKUrGH0jJ8tM0nkdRj7JPcZN8Dlnzw2o66ptOYQT J/NGgiamZPj6tU1CA5L6edDm8d+Ln7G6eC8btnf6W2J1Eem3kJlAMv3EJ5HWI3qpqCI1 LgI4rX+0uwO8Z6blnlNLY08z9puq+0c6KnQ9BmYbgD+es9y7+kqG6fLrUglpSU64xKvc FsCw== X-Gm-Message-State: ALoCoQkHq+kPI+rkaA8TskBkmKpB2dNTrNI9sZIn2nMrUBh7n/50M1f4wx//f3T9N1p0PYU/ssxj X-Received: by 10.152.206.70 with SMTP id lm6mr57251028lac.35.1426526080133; Mon, 16 Mar 2015 10:14:40 -0700 (PDT) Received: from dl160.lan (37-33-50-203.bb.dnainternet.fi. [37.33.50.203]) by mx.google.com with ESMTPSA id o4sm2300930lah.28.2015.03.16.10.14.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Mar 2015 10:14:39 -0700 (PDT) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCH 2/3] dw2102: store i2c client for tuner into dw2102_state Date: Mon, 16 Mar 2015 19:14:05 +0200 Message-Id: <1426526046-2063-2-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426526046-2063-1-git-send-email-olli.salonen@iki.fi> References: <1426526046-2063-1-git-send-email-olli.salonen@iki.fi> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Prepare the dw2102 driver for tuner drivers that are implemented as I2C drivers (such as m88ts2022). The I2C client is stored in to the state and released at disconnect. Signed-off-by: Olli Salonen Reviewed-by: Antti Palosaari --- drivers/media/usb/dvb-usb/dw2102.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c index c68a610..f7dd973 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -114,6 +114,7 @@ struct dw2102_state { u8 initialized; + struct i2c_client *i2c_client_tuner; int (*old_set_voltage)(struct dvb_frontend *f, fe_sec_voltage_t v); }; @@ -2138,10 +2139,26 @@ static int dw2102_probe(struct usb_interface *intf, return -ENODEV; } +static void dw2102_disconnect(struct usb_interface *intf) +{ + struct dvb_usb_device *d = usb_get_intfdata(intf); + struct dw2102_state *st = (struct dw2102_state *)d->priv; + struct i2c_client *client; + + /* remove I2C client for tuner */ + client = st->i2c_client_tuner; + if (client) { + module_put(client->dev.driver->owner); + i2c_unregister_device(client); + } + + dvb_usb_device_exit(intf); +} + static struct usb_driver dw2102_driver = { .name = "dw2102", .probe = dw2102_probe, - .disconnect = dvb_usb_device_exit, + .disconnect = dw2102_disconnect, .id_table = dw2102_table, };