From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755487AbdIGQyE (ORCPT ); Thu, 7 Sep 2017 12:54:04 -0400 Received: from smtprelay0004.hostedemail.com ([216.40.44.4]:46713 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752271AbdIGQyD (ORCPT ); Thu, 7 Sep 2017 12:54:03 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3871:3872:3874:4321:4605:5007:9010:10004:10400:10848:11026:11232:11658:11914:12043:12296:12740:12760:12895:13069:13311:13357:13439:14096:14097:14659:14721:21080:21451:21627:30012:30029:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: idea87_231a6b8c0e331 X-Filterd-Recvd-Size: 2108 Message-ID: <1504803239.7546.26.camel@perches.com> Subject: Re: [PATCH v2 1/3] livepatch: Add dynamic klp_object and klp_func iterators From: Joe Perches To: Petr Mladek , Jason Baron Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, jpoimboe@redhat.com, jeyu@kernel.org, jikos@kernel.org, mbenes@suse.cz Date: Thu, 07 Sep 2017 09:53:59 -0700 In-Reply-To: <20170907123452.GC3143@pathway.suse.cz> References: <20170907123452.GC3143@pathway.suse.cz> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-09-07 at 14:34 +0200, Petr Mladek wrote: > On Wed 2017-08-30 17:38:43, Jason Baron wrote: [] > > + if (list_empty(&obj->obj_entry)) { > > + next_obj = obj + 1; > > + if (next_obj->funcs || next_obj->name) > > + goto out; > > + else > > + next_obj = NULL; > > Please, add an empty line here to make it better readable. and/or just get rid of the else > > +static inline struct klp_func *func_iter_next(struct klp_object *obj, > > + struct klp_func *func) > > +{ > > + struct klp_func *next_func = NULL; > > + > > + if (list_empty(&func->func_entry)) { > > + next_func = func + 1; > > + if (next_func->old_name || next_func->new_func || > > + next_func->old_sympos) > > + goto out; > > + else > > + next_func = NULL; here too > > + if (!list_empty(&obj->func_list)) > > + next_func = container_of(obj->func_list.next, > > + struct klp_func, > > + func_entry); > > I have just realized that a practice is to use list_entry() instead > of container_of() for list entries. It probably makes the code better > readable for a trained eye.