From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 80586592A for ; Fri, 22 May 2015 04:08:30 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 21 May 2015 19:08:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,473,1427785200"; d="scan'208";a="714001683" Received: from shwdeisgchi017.ccr.corp.intel.com (HELO [10.239.66.47]) ([10.239.66.47]) by fmsmga001.fm.intel.com with ESMTP; 21 May 2015 19:08:28 -0700 Message-ID: <555E8F9B.6070306@intel.com> Date: Fri, 22 May 2015 10:08:27 +0800 From: "Liang, Cunming" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Stephen Hemminger 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> <20150521111704.727cf3a1@urahara> In-Reply-To: <20150521111704.727cf3a1@urahara> Content-Type: text/plain; charset=windows-1252; format=flowed 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: Fri, 22 May 2015 02:08:31 -0000 On 5/22/2015 2:17 AM, Stephen Hemminger wrote: > 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. Fully agree, thanks for the comment.