Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp370306imu; Fri, 21 Dec 2018 00:11:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN41L+i42twWzgzE7STaXsRj9e/a+YrtinJ+ddStH0l+S/GufTXs/SCwfaotLWN/eJyamADY X-Received: by 2002:a17:902:541:: with SMTP id 59mr1581523plf.88.1545379866606; Fri, 21 Dec 2018 00:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545379866; cv=none; d=google.com; s=arc-20160816; b=rOk3F4oZyvPx5v/BRzeSQkwCZwTN8qx0K0CS0orgPicIQaOrWpulR49Z1Cr2tT5uuy lVJED20e8XuxgbOLCL32yHoK2gFxNwtATH8CdfecGwVd6WlSj+rooGBp/VhD2F3zvVX6 Lt0cL318Y/OFbN+jjy1iSb1bkItAHuaCV4bEyS17h9FNcj9Uw34yU2vDr60d3bbCe4Q/ aLi5B+y0XcY8CDZXbcAhIcQpF8NtxNg5F/kd5CjO59GJJWAdv7Q93pvyRhTe3aVTU7UD Vi+Rrx9/DyfV7+AwQggUHn4O1c1OkYXv2T4WpG8rv8e/hYl82CiYwXZCwGyqi9YU15AV M4Ow== 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=OxANrk3yVJJo+vbjEc7Mh8mc6pQvqWgk9rbRm0n18ys=; b=hxp9PKaCtkFn8U4mfKTxWcyVNbPfCFQxNghDucbuoJJBgGMPWE0XH97DaPILbJrLXs C5qFSRXFESr3BvB9md/PxrhJ2/tY0pbJiW5zW+9kMpkoa54Z41Wt2TSnVZVn2uy4REbM NK+i/VjnTcsnlppC3BLSRF9jprFhFb9TZFYvpcM/jzPR0XJrqrrvQ6S+AIB6RF+VrwfU y4FEUjFXcmkwjp6vxjvclQ3oF/GfTiQeYOnoMqw7FUNh9fA0wt4kU9uWbj/bfiRogwSx U7E78rJYs9ueH8TLSLUwYGjJfwGrepCAvJgRhTyiiZyxZeFJCrT3H5qzu+QRIE2YXpSY jRDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sM3oLqhO; 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.10.50; Fri, 21 Dec 2018 00:11:06 -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=sM3oLqhO; 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 S2390645AbeLUBSi (ORCPT + 99 others); Thu, 20 Dec 2018 20:18:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:37522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390601AbeLUBSd (ORCPT ); Thu, 20 Dec 2018 20:18:33 -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 E78ED218E0; Fri, 21 Dec 2018 01:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545355112; bh=03LbmZk11anOIPFLGKBmyl7XOj6H/cYy65CUtkWnT00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sM3oLqhO/EHgOG3QhX98XvMsFwtUiJmCM5skDdAgcWNaffDRarOPGbQyzjBMs+ny5 4GM+2odPb5MPKrIl483Dt26DaXXRUZ6jPhcTiJCKE+Rilv/P7FQv+C3bWRAn4uI4jQ 2jgf+OS8HX+wFfdV6h5afsMVMz+2+2ff+2rBjpuk= 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 10/14] media: wl128x-radio: simplify fmc_prepare/fmc_release Date: Fri, 21 Dec 2018 02:17:48 +0100 Message-Id: <20181221011752.25627-11-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 Remove unused return code from fmc_prepare() and fmc_release() to simplify the code a bit. Signed-off-by: Sebastian Reichel --- drivers/media/radio/wl128x/fmdrv_common.c | 26 +++++++++-------------- drivers/media/radio/wl128x/fmdrv_common.h | 4 ++-- drivers/media/radio/wl128x/fmdrv_v4l2.c | 12 ++--------- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c index d584ca970556..473ec5738a11 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.c +++ b/drivers/media/radio/wl128x/fmdrv_common.c @@ -1225,7 +1225,8 @@ static int fm_power_down(struct fmdev *fmdev) if (ret < 0) return ret; - return fmc_release(fmdev); + fmc_release(fmdev); + return 0; } /* Reads init command from FM firmware file and loads to the chip */ @@ -1310,7 +1311,7 @@ static int fm_power_up(struct fmdev *fmdev, u8 mode) { u16 payload; __be16 asic_id, asic_ver; - int resp_len, ret; + int resp_len, ret = 0; u8 fw_name[50]; if (mode >= FM_MODE_ENTRY_MAX) { @@ -1322,11 +1323,7 @@ static int fm_power_up(struct fmdev *fmdev, u8 mode) * Initialize FM common module. FM GPIO toggling is * taken care in Shared Transport driver. */ - ret = fmc_prepare(fmdev); - if (ret < 0) { - fmerr("Unable to prepare FM Common\n"); - return ret; - } + fmc_prepare(fmdev); payload = FM_ENABLE; if (fmc_send_cmd(fmdev, FM_POWER_MODE, REG_WR, &payload, @@ -1366,7 +1363,8 @@ static int fm_power_up(struct fmdev *fmdev, u8 mode) } else return ret; rel: - return fmc_release(fmdev); + fmc_release(fmdev); + return ret; } /* Set FM Modes(TX, RX, OFF) */ @@ -1479,14 +1477,13 @@ static void fm_st_reg_comp_cb(void *arg, int data) * This function will be called from FM V4L2 open function. * Register with ST driver and initialize driver data. */ -int fmc_prepare(struct fmdev *fmdev) +void fmc_prepare(struct fmdev *fmdev) { static struct st_proto_s fm_st_proto; - int ret; if (test_bit(FM_CORE_READY, &fmdev->flag)) { fmdbg("FM Core is already up\n"); - return 0; + return; } memset(&fm_st_proto, 0, sizeof(fm_st_proto)); @@ -1571,22 +1568,20 @@ int fmc_prepare(struct fmdev *fmdev) fm_rx_reset_station_info(fmdev); set_bit(FM_CORE_READY, &fmdev->flag); - - return ret; } /* * This function will be called from FM V4L2 release function. * Unregister from ST driver. */ -int fmc_release(struct fmdev *fmdev) +void fmc_release(struct fmdev *fmdev) { static struct st_proto_s fm_st_proto; int ret; if (!test_bit(FM_CORE_READY, &fmdev->flag)) { fmdbg("FM Core is already down\n"); - return 0; + return; } /* Service pending read */ wake_up_interruptible(&fmdev->rx.rds.read_queue); @@ -1611,7 +1606,6 @@ int fmc_release(struct fmdev *fmdev) fmdbg("Successfully unregistered from ST\n"); clear_bit(FM_CORE_READY, &fmdev->flag); - return ret; } static int wl128x_fm_probe(struct platform_device *pdev) diff --git a/drivers/media/radio/wl128x/fmdrv_common.h b/drivers/media/radio/wl128x/fmdrv_common.h index 552e22ea6bf3..47a8f0061eb0 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.h +++ b/drivers/media/radio/wl128x/fmdrv_common.h @@ -364,8 +364,8 @@ struct fm_event_msg_hdr { #define FM_TX_ANT_IMP_500 2 /* Functions exported by FM common sub-module */ -int fmc_prepare(struct fmdev *); -int fmc_release(struct fmdev *); +void fmc_prepare(struct fmdev *); +void fmc_release(struct fmdev *); void fmc_update_region_info(struct fmdev *, u8); int fmc_send_cmd(struct fmdev *, u8, u16, diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c b/drivers/media/radio/wl128x/fmdrv_v4l2.c index affa9e199dfb..ab6384e412f9 100644 --- a/drivers/media/radio/wl128x/fmdrv_v4l2.c +++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c @@ -133,11 +133,7 @@ static int fm_v4l2_fops_open(struct file *file) if (mutex_lock_interruptible(&fmdev->mutex)) return -ERESTARTSYS; - ret = fmc_prepare(fmdev); - if (ret < 0) { - fmerr("Unable to prepare FM CORE\n"); - goto open_unlock; - } + fmc_prepare(fmdev); fmdbg("Load FM RX firmware..\n"); @@ -171,11 +167,7 @@ static int fm_v4l2_fops_release(struct file *file) goto release_unlock; } - ret = fmc_release(fmdev); - if (ret < 0) { - fmerr("FM CORE release failed\n"); - goto release_unlock; - } + fmc_release(fmdev); fmdev->radio_disconnected = 0; release_unlock: -- 2.19.2