From patchwork Fri Mar 27 11:57:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 6106351 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 3DE419F399 for ; Fri, 27 Mar 2015 11:58:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 08B4A20439 for ; Fri, 27 Mar 2015 11:58:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C925E2043C for ; Fri, 27 Mar 2015 11:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752687AbbC0L5i (ORCPT ); Fri, 27 Mar 2015 07:57:38 -0400 Received: from mail-la0-f43.google.com ([209.85.215.43]:36401 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752592AbbC0L5i (ORCPT ); Fri, 27 Mar 2015 07:57:38 -0400 Received: by labe2 with SMTP id e2so68313018lab.3 for ; Fri, 27 Mar 2015 04:57:36 -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=K8cdk7loXcZ2yKPpL4gp6euxFKkjffqkYhaQmcsxZ4U=; b=g8Iip5ZMvlngHYSDyVYyjw6HdWZBIt9zxO8qga9ZK69Srfq5JmArUl4r/ZGaB8YYNH BZFfGfbnZitaAJav4PtOXE6661gnc2xdgFXgKpTsI+wZBxTMIO2Hq06ZJy2u6kmFs6jQ T8TfC8Gw/n+cG4FojX5DY7MHr2n5Kg4Q8mj6HwFVBhUcbEUDD6KR6/s9X/MFszdIXyTz CfiePWtbgP03cIJ0JoqWtc1B94Zs9q+00bvf9ymTkyaGIRpRtWDaOCwIkhgRSRb34DpZ 3IyqcUXP7egz2UYVe3Nf/PT1hEEnaE0JIYqwLV1P0OUMzxiKkCY5QDXGALM0P4yGVVqt hbAA== X-Gm-Message-State: ALoCoQlEqFeBdbHrOhMCTR70EtMC97RkvFuVWXMZy8CQn/NiH4WAfLVVLfaR2+Yi2yPFdbve45+k X-Received: by 10.112.51.114 with SMTP id j18mr17065482lbo.97.1427457456786; Fri, 27 Mar 2015 04:57:36 -0700 (PDT) Received: from dl160.lan (37-33-50-203.bb.dnainternet.fi. [37.33.50.203]) by mx.google.com with ESMTPSA id y8sm300615lad.46.2015.03.27.04.57.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Mar 2015 04:57:35 -0700 (PDT) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCH 3/5] saa7164: store i2c_client for demod and tuner in state Date: Fri, 27 Mar 2015 13:57:17 +0200 Message-Id: <1427457439-1493-3-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427457439-1493-1-git-send-email-olli.salonen@iki.fi> References: <1427457439-1493-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 In order to support demodulators and tuners that have their drivers implemented as I2C drivers, the i2c_client should be stored in state for both. Signed-off-by: Olli Salonen --- drivers/media/pci/saa7164/saa7164-dvb.c | 16 ++++++++++++++++ drivers/media/pci/saa7164/saa7164.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/drivers/media/pci/saa7164/saa7164-dvb.c b/drivers/media/pci/saa7164/saa7164-dvb.c index 16ae715..6b9e8f6 100644 --- a/drivers/media/pci/saa7164/saa7164-dvb.c +++ b/drivers/media/pci/saa7164/saa7164-dvb.c @@ -425,6 +425,7 @@ int saa7164_dvb_unregister(struct saa7164_port *port) struct saa7164_dev *dev = port->dev; struct saa7164_buffer *b; struct list_head *c, *n; + struct i2c_client *client; dprintk(DBGLVL_DVB, "%s()\n", __func__); @@ -451,6 +452,21 @@ int saa7164_dvb_unregister(struct saa7164_port *port) dvb_unregister_frontend(dvb->frontend); dvb_frontend_detach(dvb->frontend); dvb_unregister_adapter(&dvb->adapter); + + /* remove I2C client for tuner */ + client = port->i2c_client_tuner; + if (client) { + module_put(client->dev.driver->owner); + i2c_unregister_device(client); + } + + /* remove I2C client for demodulator */ + client = port->i2c_client_demod; + if (client) { + module_put(client->dev.driver->owner); + i2c_unregister_device(client); + } + return 0; } diff --git a/drivers/media/pci/saa7164/saa7164.h b/drivers/media/pci/saa7164/saa7164.h index cd1a07c..37e450a 100644 --- a/drivers/media/pci/saa7164/saa7164.h +++ b/drivers/media/pci/saa7164/saa7164.h @@ -422,6 +422,9 @@ struct saa7164_port { u8 last_v_cc; u8 last_a_cc; u32 done_first_interrupt; + + struct i2c_client *i2c_client_demod; + struct i2c_client *i2c_client_tuner; }; struct saa7164_dev {