All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH v3 1/3] staging: lustre: include: replace OBD_CHECK_DEV by obd_check_dev
Date: Thu, 2 Apr 2015 18:49:26 +0200	[thread overview]
Message-ID: <20150402164926.GA32106@kroah.com> (raw)
In-Reply-To: <707aaaafd992944368f0b046b0e030bf68882fc1.1427987408.git.mahfouz.saif.elyazal@gmail.com>

On Thu, Apr 02, 2015 at 05:18:10PM +0200, Aya Mahfouz wrote:
> Static inline functions are preferred over macros. Hence, the function
> obd_check_dev was introduced. obd_check_dev replaces the macro
> OBD_CHECK_DEV. All functions that call obd_check_dev store the return
> values and return them if they represent an error code.
> 
> Some of the changes were carried out manually and others were
> done using coccinelle.
> 
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
> v2: removed unneeded parenthesis around the variable obd.
> v3: v2 was sent as v1. Fixed that mistake.
> 
>  drivers/staging/lustre/lustre/include/obd_class.h | 33 ++++++++++++++++++-----
>  1 file changed, 27 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
> index 5314f6f..76f55d3 100644
> --- a/drivers/staging/lustre/lustre/include/obd_class.h
> +++ b/drivers/staging/lustre/lustre/include/obd_class.h
> @@ -341,6 +341,15 @@ do {							    \
>  	}						       \
>  } while (0)
>  
> +static inline int obd_check_dev(struct obd_device *obd)
> +{
> +	if (!obd) {
> +		CERROR("NULL device\n");
> +		return -ENODEV;
> +	}
> +	return 0;
> +}
> +
>  /* ensure obd_setup and !obd_stopping */
>  #define OBD_CHECK_DEV_ACTIVE(obd)			       \
>  do {							    \
> @@ -594,7 +603,9 @@ static inline int obd_precleanup(struct obd_device *obd,
>  	int rc;
>  	DECLARE_LU_VARS(ldt, d);
>  
> -	OBD_CHECK_DEV(obd);
> +	rc = obd_check_dev(obd);
> +	if (rc)
> +		return rc;
>  	ldt = obd->obd_type->typ_lu;
>  	d = obd->obd_lu_dev;
>  	if (ldt != NULL && d != NULL) {
> @@ -620,7 +631,9 @@ static inline int obd_cleanup(struct obd_device *obd)
>  	int rc;
>  	DECLARE_LU_VARS(ldt, d);
>  
> -	OBD_CHECK_DEV(obd);
> +	rc = obd_check_dev(obd);
> +	if (rc)
> +		return rc;
>  
>  	ldt = obd->obd_type->typ_lu;
>  	d = obd->obd_lu_dev;
> @@ -668,7 +681,9 @@ obd_process_config(struct obd_device *obd, int datalen, void *data)
>  	int rc;
>  	DECLARE_LU_VARS(ldt, d);
>  
> -	OBD_CHECK_DEV(obd);
> +	rc = obd_check_dev(obd);
> +	if (rc)
> +		return rc;
>  
>  	obd->obd_process_conf = 1;
>  	ldt = obd->obd_type->typ_lu;
> @@ -1280,7 +1295,9 @@ static inline int obd_notify(struct obd_device *obd,
>  {
>  	int rc;
>  
> -	OBD_CHECK_DEV(obd);
> +	rc = obd_check_dev(obd);
> +	if (rc)
> +		return rc;
>  
>  	/* the check for async_recov is a complete hack - I'm hereby
>  	   overloading the meaning to also mean "this was called from
> @@ -1381,7 +1398,11 @@ static inline int obd_health_check(const struct lu_env *env,
>  static inline int obd_register_observer(struct obd_device *obd,
>  					struct obd_device *observer)
>  {
> -	OBD_CHECK_DEV(obd);
> +	int rc;
> +
> +	rc = obd_check_dev(obd);
> +	if (rc)
> +		return rc;
>  	down_write(&obd->obd_observer_link_sem);
>  	if (obd->obd_observer && observer) {
>  		up_write(&obd->obd_observer_link_sem);
> @@ -1389,7 +1410,7 @@ static inline int obd_register_observer(struct obd_device *obd,
>  	}
>  	obd->obd_observer = observer;
>  	up_write(&obd->obd_observer_link_sem);
> -	return 0;
> +	return rc;

Again, as I stated before, this change is not needed.

sorry,

greg k-h


  reply	other threads:[~2015-04-02 16:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 15:16 [PATCH v3 0/3] staging: lustre: include: replace macros by functions Aya Mahfouz
2015-04-02 15:18 ` [PATCH v3 1/3] staging: lustre: include: replace OBD_CHECK_DEV by obd_check_dev Aya Mahfouz
2015-04-02 16:49   ` Greg KH [this message]
2015-04-02 18:09     ` [Outreachy kernel] " Aya Mahfouz
2015-04-02 15:20 ` [PATCH v3 2/3] staging: lustre: include: replace OBD_CHECK_DEV_ACTIVE by obd_check_dev_active Aya Mahfouz
2015-04-02 15:21 ` [PATCH v3 3/3] staging: lustre: include: remove unused macros Aya Mahfouz

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=20150402164926.GA32106@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=mahfouz.saif.elyazal@gmail.com \
    --cc=outreachy-kernel@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.