Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp375424imu; Fri, 21 Dec 2018 00:17:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN4k5OLCuH1Z4ed/bKTe1O+kylv1eipekgojj3DJS9ygOmLOoY9aWnmaA8fQ0OsMg9R/j5U5 X-Received: by 2002:a17:902:4081:: with SMTP id c1mr1574220pld.87.1545380253720; Fri, 21 Dec 2018 00:17:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545380253; cv=none; d=google.com; s=arc-20160816; b=k9biJvf4PqgfkFB7pZFKmL76d3krVpqgW5ZuJEyxURtLJEttLJgSYwj95RhV1dlECY 7q4jxsQ7DIJkzpX1vFMulgYm0yQOUDOxkSTmF38NpUPvo5mb5e+1d72xZhdZAuHk7aot I1PKt3ZKjfg3LDKm9B2GRxOVyF79MNsQv4FAlXF9gIeExj6acfBSiL0eEcp5MFRnYF6C VZtEI5S67zS6GulyFoup3FdPcj5uGaPvJ1QHpptRUIArCyzqvjNbHc3FsK3Vz2GMpCt0 /FfVvahGrkL3Ib/R75BEwLiIrtEiLi6WrkVVuyD0dvta4cdpWw8E6qYdKq/U/Wolok4F PfZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gtdwEFjrCeSS9MrWcgWYdgrsrYSWQv7EE0QWm0SZrn8=; b=D6Q4fQAYy+2bZwKwasf6QZs7JSINq7opuVuKUYamYXgUZbJhYIV379qt5gbJMH1C7o xmH6K0uvflVmGFkMuWFpushmZj9Ix4Gplda0rmDZrEjbc3nQw3DfT2sgg4S5DYQxKr6/ uFqDCieXGI9zLMfVz69Ew4bFozDRAQ0leLvosJCLdpIhV78FwfmGXqqxkng2tJvAwlEb QDwr7ngdhMlN1vqJ8U6vQcOaW0+b2k1p/th0uqWo6pvyMY4zmzMKVTTXUtz028PVY4hb +90LPNQoh5s7npBqq1Lzlkq5sLjyYa8dF0s6Vbit1O7mF4HmhzR+i8h+Lse2HEHFnofN 3rpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pt33fX5R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si7749348pfn.213.2018.12.21.00.17.17; Fri, 21 Dec 2018 00:17:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pt33fX5R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390732AbeLUBTo (ORCPT + 99 others); Thu, 20 Dec 2018 20:19:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:37378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388680AbeLUBSZ (ORCPT ); Thu, 20 Dec 2018 20:18:25 -0500 Received: from mail.kernel.org (unknown [185.216.33.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2602521904; Fri, 21 Dec 2018 01:18:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545355104; bh=+Bt4mMi8YqMYFjKJbypQUlvKkRIjSTGbKPlFNh58u9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pt33fX5REvws5Bc9lx5yt6hqdH4nzdKepGUjObe12bqylEqjNhZAf/qvrGPYUF0nJ Wwy1WtcxecM6iV8/gQScWTuIQ0Y1IhI2wjVVlVRAkMg1b7oEqthamoypXmjSU/h/Jq jmIzhTt5cXPMMxql5TN19woePwUGklT0Sr67whYw= From: Sebastian Reichel To: Sebastian Reichel , Mauro Carvalho Chehab , Marcel Holtmann , Tony Lindgren Cc: Rob Herring , Greg Kroah-Hartman , Pavel Machek , linux-bluetooth@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Reichel Subject: [PATCH 07/14] media: wl128x-radio: convert to platform device Date: Fri, 21 Dec 2018 02:17:45 +0100 Message-Id: <20181221011752.25627-8-sre@kernel.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181221011752.25627-1-sre@kernel.org> References: <20181221011752.25627-1-sre@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian Reichel This converts the wl128x FM radio module into a platform device. It's a preparation for using it from hci_ll Bluetooth driver instead of TI_ST. Signed-off-by: Sebastian Reichel --- drivers/media/radio/wl128x/fmdrv_common.c | 30 ++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c index f77acec0addf..9526613adf91 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.c +++ b/drivers/media/radio/wl128x/fmdrv_common.c @@ -35,11 +35,10 @@ #include "fmdrv_v4l2.h" #include "fmdrv_common.h" #include +#include #include "fmdrv_rx.h" #include "fmdrv_tx.h" -struct fmdev *global_fmdev; - /* Region info */ static struct region_info region_configs[] = { /* Europe/US */ @@ -1615,23 +1614,19 @@ int fmc_release(struct fmdev *fmdev) return ret; } -/* - * Module init function. Ask FM V4L module to register video device. - * Allocate memory for FM driver context and RX RDS buffer. - */ -static int __init fm_drv_init(void) +static int wl128x_fm_probe(struct platform_device *dev) { struct fmdev *fmdev = NULL; int ret = -ENOMEM; fmdbg("FM driver\n"); + /* Allocate memory for FM driver context and RX RDS buffer. */ fmdev = kzalloc(sizeof(struct fmdev), GFP_KERNEL); if (NULL == fmdev) { fmerr("Can't allocate operation structure memory\n"); return ret; } - global_fmdev = fmdev; fmdev->rx.rds.buf_size = default_rds_buf * FM_RDS_BLK_SIZE; fmdev->rx.rds.buff = kzalloc(fmdev->rx.rds.buf_size, GFP_KERNEL); if (NULL == fmdev->rx.rds.buff) { @@ -1639,6 +1634,7 @@ static int __init fm_drv_init(void) goto rel_dev; } + /* Ask FM V4L module to register video device. */ ret = fm_v4l2_init_video_device(fmdev, radio_nr); if (ret < 0) goto rel_rdsbuf; @@ -1657,10 +1653,9 @@ static int __init fm_drv_init(void) return ret; } -/* Module exit function. Ask FM V4L module to unregister video device */ -static void __exit fm_drv_exit(void) +static int wl128x_fm_remove(struct platform_device *dev) { - struct fmdev *fmdev = global_fmdev; + struct fmdev *fmdev = platform_get_drvdata(pdev); /* Ask FM V4L module to unregister video device */ fm_v4l2_deinit_video_device(fmdev); @@ -1668,12 +1663,19 @@ static void __exit fm_drv_exit(void) kfree(fmdev->rx.rds.buff); kfree(fmdev); } + + return 0; } -module_init(fm_drv_init); -module_exit(fm_drv_exit); +static struct platform_driver wl128x_fm_drv = { + .driver = { + .name = "wl128x-fm", + }, + .probe = wl128x_fm_probe, + .remove = wl128x_fm_remove, +}; +module_platform_driver(wl128x_fm_drv); -/* ------------- Module Info ------------- */ MODULE_AUTHOR("Manjunatha Halli "); MODULE_DESCRIPTION("FM Driver for TI's Connectivity chip"); MODULE_LICENSE("GPL"); -- 2.19.2