From patchwork Sat Aug 8 17:46:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 40186 X-Patchwork-Delegate: dougsland@redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n78Hjao6009537 for ; Sat, 8 Aug 2009 17:46:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752680AbZHHRqH (ORCPT ); Sat, 8 Aug 2009 13:46:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752716AbZHHRqH (ORCPT ); Sat, 8 Aug 2009 13:46:07 -0400 Received: from ey-out-2122.google.com ([74.125.78.25]:39763 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752680AbZHHRqG (ORCPT ); Sat, 8 Aug 2009 13:46:06 -0400 Received: by ey-out-2122.google.com with SMTP id 9so676556eyd.37 for ; Sat, 08 Aug 2009 10:46:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=zn56Rjp2xown91bibQaqDG/NxBHDEPRvAyQbjMhnbO4=; b=wTykiuzb8DqktKXzZFuLRhcPEBcyzobbqZ8WPNwXISsd426IF4fSm/JH1y9gz5eIuE Ckv3pEFFZh2yorFICUW/KoS0i+6l1tssDmkI/AaxvBcYjCZyqZAVl4rlpWBcAzfPz/iG UYIyFCo1Su/kYCXE/23GUgh/IGlL/z1jKWB6c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=wg8Vryw6a3B+5w03lCFFcqTJ7hDKd12Y1QHTGve0zPjG1u3FMacA5JJ5fGrJXnW5O9 LZe0stbJ+X1ffu5B62ngnKU2BBCnEOaXpK0pupo8pHVhm1Ly9UgiQ6BrH2mpKcHEzal2 bBihKyr6/JmLao2c4zILG4zC3Ir2GXU3cdnPg= Received: by 10.210.111.7 with SMTP id j7mr3024609ebc.18.1249753567554; Sat, 08 Aug 2009 10:46:07 -0700 (PDT) Received: from ?95.78.132.126? ([95.78.132.126]) by mx.google.com with ESMTPS id 10sm6268219eyd.57.2009.08.08.10.46.06 (version=SSLv3 cipher=RC4-MD5); Sat, 08 Aug 2009 10:46:07 -0700 (PDT) Subject: [patch review 4/6] radio-mr800: make radio->status variable From: Alexey Klimov To: Douglas Schilling Landgraf Cc: linux-media@vger.kernel.org Date: Sat, 08 Aug 2009 21:46:08 +0400 Message-Id: <1249753568.15160.249.camel@tux.localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Remove radio->muted and radio->removed variables from amradio_device structure. Instead patch creates radio->status variable and updates code. Signed-off-by: Alexey Klimov diff -r a1ccdea5a182 linux/drivers/media/radio/radio-mr800.c --- a/linux/drivers/media/radio/radio-mr800.c Wed Jul 29 12:42:06 2009 +0400 +++ b/linux/drivers/media/radio/radio-mr800.c Sat Aug 08 17:24:05 2009 +0400 @@ -108,6 +108,8 @@ #define AMRADIO_START 0x00 #define AMRADIO_STOP 0x01 +#define DISCONNECTED -1 + /* Comfortable defines for amradio_set_stereo */ #define WANT_STEREO 0x00 #define WANT_MONO 0x01 @@ -135,11 +137,10 @@ unsigned char *buffer; struct mutex lock; /* buffer locking */ + int status; int curfreq; int stereo; int users; - int removed; - int muted; }; /* USB Device ID List */ @@ -172,7 +173,7 @@ int size; /* safety check */ - if (radio->removed) + if (unlikely(radio->status == DISCONNECTED)) return -EIO; mutex_lock(&radio->lock); @@ -194,7 +195,7 @@ return retval; } - radio->muted = argument; + radio->status = argument; mutex_unlock(&radio->lock); @@ -209,7 +210,7 @@ unsigned short freq_send = 0x10 + (radio->curfreq >> 3) / 25; /* safety check */ - if (radio->removed) + if (unlikely(radio->status == DISCONNECTED)) return -EIO; mutex_lock(&radio->lock); @@ -259,7 +260,7 @@ int size; /* safety check */ - if (radio->removed) + if (unlikely(radio->status == DISCONNECTED)) return -EIO; mutex_lock(&radio->lock); @@ -299,7 +300,7 @@ struct amradio_device *radio = usb_get_intfdata(intf); mutex_lock(&radio->lock); - radio->removed = 1; + radio->status = DISCONNECTED; mutex_unlock(&radio->lock); usb_set_intfdata(intf, NULL); @@ -329,7 +330,7 @@ int retval; /* safety check */ - if (radio->removed) + if (unlikely(radio->status == DISCONNECTED)) return -EIO; if (v->index > 0) @@ -371,7 +372,7 @@ int retval; /* safety check */ - if (radio->removed) + if (unlikely(radio->status == DISCONNECTED)) return -EIO; if (v->index > 0) @@ -406,7 +407,7 @@ int retval; /* safety check */ - if (radio->removed) + if (unlikely(radio->status == DISCONNECTED)) return -EIO; mutex_lock(&radio->lock); @@ -427,7 +428,7 @@ struct amradio_device *radio = video_get_drvdata(video_devdata(file)); /* safety check */ - if (radio->removed) + if (unlikely(radio->status == DISCONNECTED)) return -EIO; f->type = V4L2_TUNER_RADIO; @@ -454,12 +455,12 @@ struct amradio_device *radio = video_get_drvdata(video_devdata(file)); /* safety check */ - if (radio->removed) + if (unlikely(radio->status == DISCONNECTED)) return -EIO; switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: - ctrl->value = radio->muted; + ctrl->value = radio->status; return 0; } return -EINVAL; @@ -473,7 +474,7 @@ int retval; /* safety check */ - if (radio->removed) + if (unlikely(radio->status == DISCONNECTED)) return -EIO; switch (ctrl->id) { @@ -540,7 +541,6 @@ struct amradio_device *radio = video_get_drvdata(video_devdata(file)); radio->users = 1; - radio->muted = 1; return 0; } @@ -674,7 +674,7 @@ radio->videodev->ioctl_ops = &usb_amradio_ioctl_ops; radio->videodev->release = usb_amradio_video_device_release; - radio->removed = 0; + radio->status = AMRADIO_STOP; radio->users = 0; radio->usbdev = interface_to_usbdev(intf); radio->curfreq = 95.16 * FREQ_MUL;