All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/rtrs-srv: Set .release function for rtrs srv device during device init
@ 2020-09-04 13:30 Md Haris Iqbal
  2020-09-06  7:46 ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Md Haris Iqbal @ 2020-09-04 13:30 UTC (permalink / raw)
  To: danil.kipnis, jinpu.wang, linux-rdma, dledford, jgg, leon; +Cc: Md Haris Iqbal

The device .release function was not being set during the device
initialization. This was leading to the below warning, in error cases when
put_srv was called before device_add was called.

Warning:

Device '(null)' does not have a release() function, it is broken and must
be fixed. See Documentation/kobject.txt.

So, set the device .release function during device initialization in the
__alloc_srv() function.

Fixes: baa5b28b7a474 ("RDMA/rtrs-srv: Replace device_register with..")
Signed-off-by: Md Haris Iqbal <haris.iqbal@cloud.ionos.com>
---
 drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 8 --------
 drivers/infiniband/ulp/rtrs/rtrs-srv.c       | 8 ++++++++
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
index 2f981ae97076..cf6a2be61695 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
@@ -152,13 +152,6 @@ static struct attribute_group rtrs_srv_stats_attr_group = {
 	.attrs = rtrs_srv_stats_attrs,
 };
 
-static void rtrs_srv_dev_release(struct device *dev)
-{
-	struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev);
-
-	kfree(srv);
-}
-
 static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
 {
 	struct rtrs_srv *srv = sess->srv;
@@ -172,7 +165,6 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
 		goto unlock;
 	}
 	srv->dev.class = rtrs_dev_class;
-	srv->dev.release = rtrs_srv_dev_release;
 	err = dev_set_name(&srv->dev, "%s", sess->s.sessname);
 	if (err)
 		goto unlock;
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
index b61a18e57aeb..28f6414dfa3d 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
@@ -1319,6 +1319,13 @@ static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_sess *sess)
 	return sess->cur_cq_vector;
 }
 
+static void rtrs_srv_dev_release(struct device *dev)
+{
+	struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev);
+
+	kfree(srv);
+}
+
 static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx,
 				     const uuid_t *paths_uuid)
 {
@@ -1337,6 +1344,7 @@ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx,
 	srv->queue_depth = sess_queue_depth;
 	srv->ctx = ctx;
 	device_initialize(&srv->dev);
+	srv->dev.release = rtrs_srv_dev_release;
 
 	srv->chunks = kcalloc(srv->queue_depth, sizeof(*srv->chunks),
 			      GFP_KERNEL);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/rtrs-srv: Set .release function for rtrs srv device during device init
  2020-09-04 13:30 [PATCH] RDMA/rtrs-srv: Set .release function for rtrs srv device during device init Md Haris Iqbal
@ 2020-09-06  7:46 ` Leon Romanovsky
  2020-09-06 14:02   ` Haris Iqbal
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2020-09-06  7:46 UTC (permalink / raw)
  To: Md Haris Iqbal; +Cc: danil.kipnis, jinpu.wang, linux-rdma, dledford, jgg

On Fri, Sep 04, 2020 at 07:00:38PM +0530, Md Haris Iqbal wrote:
> The device .release function was not being set during the device
> initialization. This was leading to the below warning, in error cases when
> put_srv was called before device_add was called.
>
> Warning:
>
> Device '(null)' does not have a release() function, it is broken and must
> be fixed. See Documentation/kobject.txt.
>
> So, set the device .release function during device initialization in the
> __alloc_srv() function.
>
> Fixes: baa5b28b7a474 ("RDMA/rtrs-srv: Replace device_register with..")

Please don't truncate Fixes line, many of us rely on full line for automation.

Thanks

> Signed-off-by: Md Haris Iqbal <haris.iqbal@cloud.ionos.com>
> ---
>  drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 8 --------
>  drivers/infiniband/ulp/rtrs/rtrs-srv.c       | 8 ++++++++
>  2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
> index 2f981ae97076..cf6a2be61695 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
> @@ -152,13 +152,6 @@ static struct attribute_group rtrs_srv_stats_attr_group = {
>  	.attrs = rtrs_srv_stats_attrs,
>  };
>
> -static void rtrs_srv_dev_release(struct device *dev)
> -{
> -	struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev);
> -
> -	kfree(srv);
> -}
> -
>  static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
>  {
>  	struct rtrs_srv *srv = sess->srv;
> @@ -172,7 +165,6 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
>  		goto unlock;
>  	}
>  	srv->dev.class = rtrs_dev_class;
> -	srv->dev.release = rtrs_srv_dev_release;
>  	err = dev_set_name(&srv->dev, "%s", sess->s.sessname);
>  	if (err)
>  		goto unlock;
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> index b61a18e57aeb..28f6414dfa3d 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> @@ -1319,6 +1319,13 @@ static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_sess *sess)
>  	return sess->cur_cq_vector;
>  }
>
> +static void rtrs_srv_dev_release(struct device *dev)
> +{
> +	struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev);
> +
> +	kfree(srv);
> +}
> +
>  static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx,
>  				     const uuid_t *paths_uuid)
>  {
> @@ -1337,6 +1344,7 @@ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx,
>  	srv->queue_depth = sess_queue_depth;
>  	srv->ctx = ctx;
>  	device_initialize(&srv->dev);
> +	srv->dev.release = rtrs_srv_dev_release;
>
>  	srv->chunks = kcalloc(srv->queue_depth, sizeof(*srv->chunks),
>  			      GFP_KERNEL);
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/rtrs-srv: Set .release function for rtrs srv device during device init
  2020-09-06  7:46 ` Leon Romanovsky
@ 2020-09-06 14:02   ` Haris Iqbal
  0 siblings, 0 replies; 3+ messages in thread
From: Haris Iqbal @ 2020-09-06 14:02 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Danil Kipnis, Jinpu Wang, linux-rdma, Doug Ledford, Jason Gunthorpe

On Sun, Sep 6, 2020 at 1:16 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Fri, Sep 04, 2020 at 07:00:38PM +0530, Md Haris Iqbal wrote:
> > The device .release function was not being set during the device
> > initialization. This was leading to the below warning, in error cases when
> > put_srv was called before device_add was called.
> >
> > Warning:
> >
> > Device '(null)' does not have a release() function, it is broken and must
> > be fixed. See Documentation/kobject.txt.
> >
> > So, set the device .release function during device initialization in the
> > __alloc_srv() function.
> >
> > Fixes: baa5b28b7a474 ("RDMA/rtrs-srv: Replace device_register with..")
>
> Please don't truncate Fixes line, many of us rely on full line for automation.

Sure. Didn't know that. Will send the updated patch. Thanks.

>
> Thanks
>
> > Signed-off-by: Md Haris Iqbal <haris.iqbal@cloud.ionos.com>
> > ---
> >  drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 8 --------
> >  drivers/infiniband/ulp/rtrs/rtrs-srv.c       | 8 ++++++++
> >  2 files changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
> > index 2f981ae97076..cf6a2be61695 100644
> > --- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
> > +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
> > @@ -152,13 +152,6 @@ static struct attribute_group rtrs_srv_stats_attr_group = {
> >       .attrs = rtrs_srv_stats_attrs,
> >  };
> >
> > -static void rtrs_srv_dev_release(struct device *dev)
> > -{
> > -     struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev);
> > -
> > -     kfree(srv);
> > -}
> > -
> >  static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
> >  {
> >       struct rtrs_srv *srv = sess->srv;
> > @@ -172,7 +165,6 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
> >               goto unlock;
> >       }
> >       srv->dev.class = rtrs_dev_class;
> > -     srv->dev.release = rtrs_srv_dev_release;
> >       err = dev_set_name(&srv->dev, "%s", sess->s.sessname);
> >       if (err)
> >               goto unlock;
> > diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> > index b61a18e57aeb..28f6414dfa3d 100644
> > --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> > +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> > @@ -1319,6 +1319,13 @@ static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_sess *sess)
> >       return sess->cur_cq_vector;
> >  }
> >
> > +static void rtrs_srv_dev_release(struct device *dev)
> > +{
> > +     struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev);
> > +
> > +     kfree(srv);
> > +}
> > +
> >  static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx,
> >                                    const uuid_t *paths_uuid)
> >  {
> > @@ -1337,6 +1344,7 @@ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx,
> >       srv->queue_depth = sess_queue_depth;
> >       srv->ctx = ctx;
> >       device_initialize(&srv->dev);
> > +     srv->dev.release = rtrs_srv_dev_release;
> >
> >       srv->chunks = kcalloc(srv->queue_depth, sizeof(*srv->chunks),
> >                             GFP_KERNEL);
> > --
> > 2.25.1
> >



-- 

Regards
-Haris

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-06 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 13:30 [PATCH] RDMA/rtrs-srv: Set .release function for rtrs srv device during device init Md Haris Iqbal
2020-09-06  7:46 ` Leon Romanovsky
2020-09-06 14:02   ` Haris Iqbal

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.