Message ID | 1324481454-30066-1-git-send-email-scott.jiang.linux@gmail.com (mailing list archive) |
---|---|
State | Rejected, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1RdCvz-0007Zl-Pu; Wed, 21 Dec 2011 04:33:40 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-4) with esmtp id 1RdCvz-0001h7-9s; Wed, 21 Dec 2011 04:33:39 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752146Ab1LUDdg (ORCPT <rfc822;patchwork@linuxtv.org> + 3 others); Tue, 20 Dec 2011 22:33:36 -0500 Received: from db3ehsobe006.messaging.microsoft.com ([213.199.154.144]:4917 "EHLO DB3EHSOBE006.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751719Ab1LUDdg (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 20 Dec 2011 22:33:36 -0500 Received: from mail1-db3-R.bigfish.com (10.3.81.251) by DB3EHSOBE006.bigfish.com (10.3.84.26) with Microsoft SMTP Server id 14.1.225.23; Wed, 21 Dec 2011 03:33:26 +0000 Received: from mail1-db3 (localhost [127.0.0.1]) by mail1-db3-R.bigfish.com (Postfix) with ESMTP id A11E04800E1; Wed, 21 Dec 2011 03:33:55 +0000 (UTC) X-SpamScore: 1 X-BigFish: VS1(zzzz1202hzz8275bhz2ei87h2a8h668h839h) X-Forefront-Antispam-Report: CIP:137.71.25.55; KIP:(null); UIP:(null); IPV:NLI; H:nwd2mta1.analog.com; RD:nwd2mail10.analog.com; EFVD:NLI Received-SPF: neutral (mail1-db3: 137.71.25.55 is neither permitted nor denied by domain of gmail.com) client-ip=137.71.25.55; envelope-from=scott.jiang.linux@gmail.com; helo=nwd2mta1.analog.com ; 1.analog.com ; X-FB-DOMAIN-IP-MATCH: fail Received: from mail1-db3 (localhost.localdomain [127.0.0.1]) by mail1-db3 (MessageSwitch) id 1324438435568125_2455; Wed, 21 Dec 2011 03:33:55 +0000 (UTC) Received: from DB3EHSMHS001.bigfish.com (unknown [10.3.81.254]) by mail1-db3.bigfish.com (Postfix) with ESMTP id 84D13280042; Wed, 21 Dec 2011 03:33:55 +0000 (UTC) Received: from nwd2mta1.analog.com (137.71.25.55) by DB3EHSMHS001.bigfish.com (10.3.87.101) with Microsoft SMTP Server (TLS) id 14.1.225.23; Wed, 21 Dec 2011 03:33:25 +0000 Received: from NWD2HUBCAS1.ad.analog.com (nwd2hubcas1.ad.analog.com [10.64.73.29]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id pBL3Qrfh011204 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 20 Dec 2011 22:26:54 -0500 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS1.ad.analog.com (10.64.73.29) with Microsoft SMTP Server id 8.3.83.0; Tue, 20 Dec 2011 22:33:15 -0500 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.5/8.14.5) with ESMTP id pBL3XTmM006916; Tue, 20 Dec 2011 22:33:29 -0500 (EST) Received: from localhost.localdomain (unknown [10.99.24.72]) by linux.site (Postfix) with ESMTP id 368A4429B53A; Tue, 20 Dec 2011 12:52:30 -0700 (MST) From: Scott Jiang <scott.jiang.linux@gmail.com> To: <sakari.ailus@iki.fi>, Hans Verkuil <hverkuil@xs4all.nl>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Mauro Carvalho Chehab <mchehab@infradead.org>, <linux-media@vger.kernel.org>, <uclinux-dist-devel@blackfin.uclinux.org> CC: Scott Jiang <scott.jiang.linux@gmail.com> Subject: [PATCH] v4l2: v4l2-fh: v4l2_fh_is_singular should use list head to test Date: Wed, 21 Dec 2011 10:30:54 -0500 Message-ID: <1324481454-30066-1-git-send-email-scott.jiang.linux@gmail.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.12.21.32116 X-PMX-Spam: Gauge=XIIIII, Probability=15%, Report=' DATE_IN_FUTURE_06_12 1.3, FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_1099 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, DATE_TZ_NEG_0500 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_TO_X5 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' X-LSpam-Score: 0.0 (/) |
Commit Message
Scott Jiang
Dec. 21, 2011, 3:30 p.m. UTC
list_is_singular accepts a list head to test whether a list has just one entry.
fh->list is the entry, fh->vdev->fh_list is the list head.
Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com>
---
drivers/media/video/v4l2-fh.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Comments
Hi Scott, Thanks for the patch. On Wed, Dec 21, 2011 at 10:30:54AM -0500, Scott Jiang wrote: > list_is_singular accepts a list head to test whether a list has just one entry. > fh->list is the entry, fh->vdev->fh_list is the list head. > > Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com> > --- > drivers/media/video/v4l2-fh.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/media/video/v4l2-fh.c b/drivers/media/video/v4l2-fh.c > index 9e3fc04..8292c4a 100644 > --- a/drivers/media/video/v4l2-fh.c > +++ b/drivers/media/video/v4l2-fh.c > @@ -113,7 +113,7 @@ int v4l2_fh_is_singular(struct v4l2_fh *fh) > if (fh == NULL || fh->vdev == NULL) > return 0; > spin_lock_irqsave(&fh->vdev->fh_lock, flags); > - is_singular = list_is_singular(&fh->list); > + is_singular = list_is_singular(&fh->vdev->fh_list); > spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); > return is_singular; > } Is there an issue that this patch resolves, or am I missing something? As far as I can see, the list_is_singular() test returns the same result whether you are testing a list item which is part of the list, or its head in struct video_device. Kind regards,
2012/1/4 Sakari Ailus <sakari.ailus@iki.fi>: > Hi Scott, > > Thanks for the patch. > > On Wed, Dec 21, 2011 at 10:30:54AM -0500, Scott Jiang wrote: >> list_is_singular accepts a list head to test whether a list has just one entry. >> fh->list is the entry, fh->vdev->fh_list is the list head. >> >> Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com> >> --- >> drivers/media/video/v4l2-fh.c | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/media/video/v4l2-fh.c b/drivers/media/video/v4l2-fh.c >> index 9e3fc04..8292c4a 100644 >> --- a/drivers/media/video/v4l2-fh.c >> +++ b/drivers/media/video/v4l2-fh.c >> @@ -113,7 +113,7 @@ int v4l2_fh_is_singular(struct v4l2_fh *fh) >> if (fh == NULL || fh->vdev == NULL) >> return 0; >> spin_lock_irqsave(&fh->vdev->fh_lock, flags); >> - is_singular = list_is_singular(&fh->list); >> + is_singular = list_is_singular(&fh->vdev->fh_list); >> spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); >> return is_singular; >> } > > Is there an issue that this patch resolves, or am I missing something? As > far as I can see, the list_is_singular() test returns the same result > whether you are testing a list item which is part of the list, or its head > in struct video_device. > Yes, the result is the same. But I don't think it's a good example because it may abuse this api. Can anybody figure out what this api needs you to pass in? I confess I am not sure about that. Scott -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Jan 05, 2012 at 10:52:02AM +0800, Scott Jiang wrote: > 2012/1/4 Sakari Ailus <sakari.ailus@iki.fi>: > > Hi Scott, > > > > Thanks for the patch. > > > > On Wed, Dec 21, 2011 at 10:30:54AM -0500, Scott Jiang wrote: > >> list_is_singular accepts a list head to test whether a list has just one entry. > >> fh->list is the entry, fh->vdev->fh_list is the list head. > >> > >> Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com> > >> --- > >> drivers/media/video/v4l2-fh.c | 2 +- > >> 1 files changed, 1 insertions(+), 1 deletions(-) > >> > >> diff --git a/drivers/media/video/v4l2-fh.c b/drivers/media/video/v4l2-fh.c > >> index 9e3fc04..8292c4a 100644 > >> --- a/drivers/media/video/v4l2-fh.c > >> +++ b/drivers/media/video/v4l2-fh.c > >> @@ -113,7 +113,7 @@ int v4l2_fh_is_singular(struct v4l2_fh *fh) > >> if (fh == NULL || fh->vdev == NULL) > >> return 0; > >> spin_lock_irqsave(&fh->vdev->fh_lock, flags); > >> - is_singular = list_is_singular(&fh->list); > >> + is_singular = list_is_singular(&fh->vdev->fh_list); > >> spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); > >> return is_singular; > >> } > > > > Is there an issue that this patch resolves, or am I missing something? As > > far as I can see, the list_is_singular() test returns the same result > > whether you are testing a list item which is part of the list, or its head > > in struct video_device. > > > Yes, the result is the same. But I don't think it's a good example > because it may abuse this api. > Can anybody figure out what this api needs you to pass in? I confess > I am not sure about that. That's true; it's more correct (and intuitive as well) to use the real list head for the purpose. But if the implementation really changed I bet a huge number of other things would break as well. Acked-by: Sakari Ailus <sakari.ailus@iki.fi> Hans: you wrote the patch adding this code (dfddb244); what do you think? Regards,
On 05-01-2012 05:57, Sakari Ailus wrote: > On Thu, Jan 05, 2012 at 10:52:02AM +0800, Scott Jiang wrote: >> 2012/1/4 Sakari Ailus <sakari.ailus@iki.fi>: >>> Hi Scott, >>> >>> Thanks for the patch. >>> >>> On Wed, Dec 21, 2011 at 10:30:54AM -0500, Scott Jiang wrote: >>>> list_is_singular accepts a list head to test whether a list has just one entry. >>>> fh->list is the entry, fh->vdev->fh_list is the list head. >>>> >>>> Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com> >>>> --- >>>> drivers/media/video/v4l2-fh.c | 2 +- >>>> 1 files changed, 1 insertions(+), 1 deletions(-) >>>> >>>> diff --git a/drivers/media/video/v4l2-fh.c b/drivers/media/video/v4l2-fh.c >>>> index 9e3fc04..8292c4a 100644 >>>> --- a/drivers/media/video/v4l2-fh.c >>>> +++ b/drivers/media/video/v4l2-fh.c >>>> @@ -113,7 +113,7 @@ int v4l2_fh_is_singular(struct v4l2_fh *fh) >>>> if (fh == NULL || fh->vdev == NULL) >>>> return 0; >>>> spin_lock_irqsave(&fh->vdev->fh_lock, flags); >>>> - is_singular = list_is_singular(&fh->list); >>>> + is_singular = list_is_singular(&fh->vdev->fh_list); >>>> spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); >>>> return is_singular; >>>> } >>> >>> Is there an issue that this patch resolves, or am I missing something? As >>> far as I can see, the list_is_singular() test returns the same result >>> whether you are testing a list item which is part of the list, or its head >>> in struct video_device. >>> >> Yes, the result is the same. But I don't think it's a good example >> because it may abuse this api. >> Can anybody figure out what this api needs you to pass in? I confess >> I am not sure about that. > > That's true; it's more correct (and intuitive as well) to use the real list > head for the purpose. But if the implementation really changed I bet a huge > number of other things would break as well. > > Acked-by: Sakari Ailus <sakari.ailus@iki.fi> > > Hans: you wrote the patch adding this code (dfddb244); what do you think? All those list functions can operate on any node of the list, since the list is circular. So, there's not a real "head" for the list. The function implementation shows that: static inline void INIT_LIST_HEAD(struct list_head *list) { list->next = list; list->prev = list; } ... static inline int list_is_singular(const struct list_head *head) { return !list_empty(head) && (head->next == head->prev); } So, I prefer to not change it, _unless_ for some reason, you hit a bug on it (for example, by not having one of the list pointers filled). Regards, Mauro > > Regards, > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/video/v4l2-fh.c b/drivers/media/video/v4l2-fh.c index 9e3fc04..8292c4a 100644 --- a/drivers/media/video/v4l2-fh.c +++ b/drivers/media/video/v4l2-fh.c @@ -113,7 +113,7 @@ int v4l2_fh_is_singular(struct v4l2_fh *fh) if (fh == NULL || fh->vdev == NULL) return 0; spin_lock_irqsave(&fh->vdev->fh_lock, flags); - is_singular = list_is_singular(&fh->list); + is_singular = list_is_singular(&fh->vdev->fh_list); spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); return is_singular; }