linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Petr Mladek <pmladek@suse.com>, Jason Baron <jbaron@akamai.com>
Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
	jpoimboe@redhat.com, jeyu@kernel.org, jikos@kernel.org,
	mbenes@suse.cz
Subject: Re: [PATCH v2 1/3] livepatch: Add dynamic klp_object and klp_func iterators
Date: Thu, 07 Sep 2017 09:53:59 -0700	[thread overview]
Message-ID: <1504803239.7546.26.camel@perches.com> (raw)
In-Reply-To: <20170907123452.GC3143@pathway.suse.cz>

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.

  reply	other threads:[~2017-09-07 16:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 21:38 [PATCH v2 0/3] livepatch: introduce atomic replace Jason Baron
2017-08-30 21:38 ` [PATCH v2 1/3] livepatch: Add dynamic klp_object and klp_func iterators Jason Baron
2017-09-07 12:34   ` Petr Mladek
2017-09-07 16:53     ` Joe Perches [this message]
2017-08-30 21:38 ` [PATCH v2 2/3] livepatch: add atomic replace Jason Baron
2017-09-11 13:53   ` Petr Mladek
2017-09-12  3:46     ` Jason Baron
2017-09-12  8:35       ` Petr Mladek
2017-09-13  6:47         ` Jason Baron
2017-09-14 13:32           ` Petr Mladek
2017-09-14 15:31             ` Jason Baron
2017-09-15 15:46               ` Petr Mladek
2017-09-16  0:10                 ` Greg KH
2017-08-30 21:38 ` [PATCH v2 3/3] livepatch: Add a sysctl livepatch_mode for " Jason Baron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1504803239.7546.26.camel@perches.com \
    --to=joe@perches.com \
    --cc=jbaron@akamai.com \
    --cc=jeyu@kernel.org \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=pmladek@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).