Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp368030imu; Fri, 21 Dec 2018 00:08:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/WWZIO5rpjfGaIJ1WLcPqCDhTff0eqRbsYu3UVC6cvGcWcuoK3PRDZdFJRvInPY6t6ZWS9z X-Received: by 2002:a62:345:: with SMTP id 66mr1497900pfd.189.1545379715981; Fri, 21 Dec 2018 00:08:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545379715; cv=none; d=google.com; s=arc-20160816; b=WGXuN5FpAw0M5+UzRPLTiVtDZ1kSAByySQY0Izck0gzVDV1P71zwyRhZOMocgBZFH0 fXIpFSh/yAlh4VVfM9HoiMRuCLEp5jUwg8zqmz/rhqwJ4K3BY3NQLBY5UE+J2uZA2/MC TqobljpNwCGCNf6r2oyNzWzBNjzDm0C3y/8+1fqQy45MoPJTaaUTa9o++q4H+MNZtRn5 CrUhaTjWunTP5P9pUyCydzou/dLdi0rOfrZtH+Vb9G0yN9ms1g4i5mpyUwvT/dVU9KmE 2cBEvfPYvUOlKdvYxY1rVHQx9KpurU/v4bd6wiInCTUPJxtwpm10io80Y3Dww4eIRart iZWQ== 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=OWDJpi4kLWTgavGdvclQH2sALFAsgznlZx1eCIiUdJg=; b=uIIfwI8FooJlgutcxTx1VK/Muk3hn83bq7W/Q75qKaqSAoX5S1nY1/fXQSsVym8K+r nsz5wttLRdXz9T2mrFNA6BBkFAZTF0K+aKxPE7sjennxJJXBzt8jwFATleUWdiTB1Yet Jl/7emADBtoKCju8a329h602FdbfYkxPuQztTx3CJTTCtqtY0Iq+R2aFOVrGUiAhue24 yKlYMO/6vV59lRWIrLASi31d7X8p3B5qLBpajeQjU9OS6eGGnAjaQt2HcYB5/rxXtPOQ Q2SouXy7VvOkUBzxvKyPatcTdb4zdUPSXd7QoPmgzK1zLEgChP928OfKxUjZJ/4JFbOA C2IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GulHGxSN; 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 j91si21404089pld.395.2018.12.21.00.08.20; Fri, 21 Dec 2018 00:08:35 -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=GulHGxSN; 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 S2388733AbeLUBS1 (ORCPT + 99 others); Thu, 20 Dec 2018 20:18:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:37276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388648AbeLUBSU (ORCPT ); Thu, 20 Dec 2018 20:18:20 -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 E5D4021907; Fri, 21 Dec 2018 01:18:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545355099; bh=tytiSmQOqHm4N1cq03I32DUKolSOX1kji1iS3bg0fGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GulHGxSNtHauBAnDTqzV4KuOSpSbDvfvqrLTaVbpajc+bYvuH0r43XHoqeCTk3UoV qbL+n7F2B9fSkeEsMioY7+jY35xYGwrkOSNaK1UgfACk+gkYrGfNKuTUctP/ij/qvO mnGUwvCm/GlxPdsxlE1904frit1Z9dRnbnCLdWKQ= 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 05/14] media: wl128x-radio: remove global radio_disconnected Date: Fri, 21 Dec 2018 02:17:43 +0100 Message-Id: <20181221011752.25627-6-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 Move global radio_disconnected into device structure to prepare converting this driver into a normal platform device driver supporting multiple instances. Signed-off-by: Sebastian Reichel --- drivers/media/radio/wl128x/fmdrv.h | 1 + drivers/media/radio/wl128x/fmdrv_v4l2.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/radio/wl128x/fmdrv.h b/drivers/media/radio/wl128x/fmdrv.h index 8ed7c0aeb8b9..fa89eef59295 100644 --- a/drivers/media/radio/wl128x/fmdrv.h +++ b/drivers/media/radio/wl128x/fmdrv.h @@ -201,6 +201,7 @@ struct fmdev { struct v4l2_device v4l2_dev; /* V4L2 top level struct */ struct snd_card *card; /* Card which holds FM mixer controls */ u16 asci_id; + u8 radio_disconnected; spinlock_t rds_buff_lock; /* To protect access to RDS buffer */ spinlock_t resp_skb_lock; /* To protect access to received SKB */ diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c b/drivers/media/radio/wl128x/fmdrv_v4l2.c index e25fd4d4d280..f541b5802844 100644 --- a/drivers/media/radio/wl128x/fmdrv_v4l2.c +++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c @@ -33,7 +33,6 @@ #include "fmdrv_tx.h" static struct video_device gradio_dev; -static u8 radio_disconnected; /* -- V4L2 RADIO (/dev/radioX) device file operation interfaces --- */ @@ -47,7 +46,7 @@ static ssize_t fm_v4l2_fops_read(struct file *file, char __user * buf, fmdev = video_drvdata(file); - if (!radio_disconnected) { + if (!fmdev->radio_disconnected) { fmerr("FM device is already disconnected\n"); return -EIO; } @@ -126,14 +125,14 @@ static int fm_v4l2_fops_open(struct file *file) int ret; struct fmdev *fmdev = NULL; + fmdev = video_drvdata(file); + /* Don't allow multiple open */ - if (radio_disconnected) { + if (fmdev->radio_disconnected) { fmerr("FM device is already opened\n"); return -EBUSY; } - fmdev = video_drvdata(file); - if (mutex_lock_interruptible(&fmdev->mutex)) return -ERESTARTSYS; ret = fmc_prepare(fmdev); @@ -149,7 +148,7 @@ static int fm_v4l2_fops_open(struct file *file) fmerr("Unable to load FM RX firmware\n"); goto open_unlock; } - radio_disconnected = 1; + fmdev->radio_disconnected = 1; open_unlock: mutex_unlock(&fmdev->mutex); @@ -162,7 +161,7 @@ static int fm_v4l2_fops_release(struct file *file) struct fmdev *fmdev; fmdev = video_drvdata(file); - if (!radio_disconnected) { + if (!fmdev->radio_disconnected) { fmdbg("FM device is already closed\n"); return 0; } @@ -179,7 +178,7 @@ static int fm_v4l2_fops_release(struct file *file) fmerr("FM CORE release failed\n"); goto release_unlock; } - radio_disconnected = 0; + fmdev->radio_disconnected = 0; release_unlock: mutex_unlock(&fmdev->mutex); -- 2.19.2