From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by dpdk.org (Postfix) with ESMTP id AFE7E5A0A for ; Thu, 21 May 2015 20:22:07 +0200 (CEST) Received: by pabts4 with SMTP id ts4so113380762pab.3 for ; Thu, 21 May 2015 11:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=qqtbu8wupdQmGji+m+jmF487spqgDVRZWF9g1yzVEfk=; b=Ewp4Uh4N5zWBrIAOIj0EPZ4h4IjsDtMVBBvG4P5Vlb+iMPmcOQeZihzqdh9Zg97nWf GGL9X+nm2Wm/sBTHgKSp7EJm3u60woDA4jd/t8TXJOcHihMnYQvDqZNjPo9cndipVOjN vcrYZUopDPpHMWRtA8dgEumawj+WsMixXcOj1kNyjwRFXC1vRldObPz/Shdm6//yeQux iw/taS65W6eZNwbkUP1dPybrvrPPnMVjFJxwx9bQt1HroCy/N7RT63HnKvgax5VjRAAV uIfdnoUfH16Va/l3lwc2tQ1K/O+lM4HJSghMpwl3cRSLfug6LLkGgtWEDgTgUWOG7GL6 Y44Q== X-Gm-Message-State: ALoCoQlstMFNRLACdZkolAT5KpRn8puTn/shIVmPjJvGexuDe0KYlYOjkMF4T8IjCBLVoqpRv3Ae X-Received: by 10.70.135.195 with SMTP id pu3mr8186211pdb.0.1432232527107; Thu, 21 May 2015 11:22:07 -0700 (PDT) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id ja1sm16065321pbc.51.2015.05.21.11.22.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 May 2015 11:22:06 -0700 (PDT) Date: Thu, 21 May 2015 11:22:05 -0700 From: Stephen Hemminger To: Cunming Liang Message-ID: <20150521112205.4caf6bd0@urahara> In-Reply-To: <1432198563-16334-3-git-send-email-cunming.liang@intel.com> References: <1430804386-28949-1-git-send-email-cunming.liang@intel.com> <1432198563-16334-1-git-send-email-cunming.liang@intel.com> <1432198563-16334-3-git-send-email-cunming.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, liang-min.wang@intel.com Subject: Re: [dpdk-dev] [PATCH v8 02/11] eal/linux: add rte_epoll_wait/ctl support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2015 18:22:08 -0000 On Thu, 21 May 2015 16:55:54 +0800 Cunming Liang wrote: > +static int > +eal_epoll_process_event(struct epoll_event *evs, int n, > + struct rte_epoll_event *events) > +{ > + int i; > + int count = 0; > + struct rte_epoll_event *rev; > + for (i = 0; i < n; i++) { > + rev = (struct rte_epoll_event *)evs[i].data.ptr; > + if (!rev || !rte_atomic32_cmpset(&rev->status, RTE_EPOLL_VALID, > + RTE_EPOLL_EXEC)) > + continue; > + > + events[count].status = RTE_EPOLL_VALID; > + events[count].fd = rev->fd; > + events[count].epfd = rev->epfd; > + events[count].epdata.event = rev->epdata.event; > + events[count].epdata.data = rev->epdata.data; This code has several style issues: 1. Always put blank line after declarations 2. Use unsigned where ever it makes sense as a matter of habit. unsigned int i, count = 0; 3. Don't add casts where not necessary, it reduces compiler type checking and is a bad habit. In this case evs[i].data.ptr is void * and therefore no cast is needed.