From: Gabriel Krisman Bertazi <krisman@collabora.com>
To: gregkh@linuxfoundation.org
Cc: rafael@kernel.org, lduncan@suse.com, cleech@redhat.com,
jejb@linux.ibm.com, martin.petersen@oracle.com,
open-iscsi@googlegroups.com, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org,
Gabriel Krisman Bertazi <krisman@collabora.com>,
kernel@collabora.com
Subject: [PATCH 2/3] drivers: base: Propagate errors through the transport component
Date: Mon, 6 Jan 2020 13:58:16 -0500 [thread overview]
Message-ID: <20200106185817.640331-3-krisman@collabora.com> (raw)
In-Reply-To: <20200106185817.640331-1-krisman@collabora.com>
The transport registration may fail. Make sure the errors are
propagated to the callers.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
drivers/base/transport_class.c | 11 ++++++++---
include/linux/transport_class.h | 6 +++---
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/base/transport_class.c b/drivers/base/transport_class.c
index 5ed86ded6e6b..ccc86206e508 100644
--- a/drivers/base/transport_class.c
+++ b/drivers/base/transport_class.c
@@ -30,6 +30,10 @@
#include <linux/attribute_container.h>
#include <linux/transport_class.h>
+static int transport_remove_classdev(struct attribute_container *cont,
+ struct device *dev,
+ struct device *classdev);
+
/**
* transport_class_register - register an initial transport class
*
@@ -172,10 +176,11 @@ static int transport_add_class_device(struct attribute_container *cont,
* routine is simply a trigger point used to add the device to the
* system and register attributes for it.
*/
-
-void transport_add_device(struct device *dev)
+int transport_add_device(struct device *dev)
{
- attribute_container_device_trigger(dev, transport_add_class_device);
+ return attribute_container_device_trigger_safe(dev,
+ transport_add_class_device,
+ transport_remove_classdev);
}
EXPORT_SYMBOL_GPL(transport_add_device);
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h
index a9c59761927b..63076fb835e3 100644
--- a/include/linux/transport_class.h
+++ b/include/linux/transport_class.h
@@ -62,16 +62,16 @@ struct transport_container {
container_of(x, struct transport_container, ac)
void transport_remove_device(struct device *);
-void transport_add_device(struct device *);
+int transport_add_device(struct device *);
void transport_setup_device(struct device *);
void transport_configure_device(struct device *);
void transport_destroy_device(struct device *);
-static inline void
+static inline int
transport_register_device(struct device *dev)
{
transport_setup_device(dev);
- transport_add_device(dev);
+ return transport_add_device(dev);
}
static inline void
--
2.24.1
next prev parent reply other threads:[~2020-01-06 18:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-06 18:58 [PATCH 0/3] drivers base: transport component error propagation Gabriel Krisman Bertazi
2020-01-06 18:58 ` [PATCH 1/3] drivers: base: Support atomic version of attribute_container_device_trigger Gabriel Krisman Bertazi
2020-01-14 15:05 ` Greg KH
2020-01-06 18:58 ` Gabriel Krisman Bertazi [this message]
2020-01-14 15:05 ` [PATCH 2/3] drivers: base: Propagate errors through the transport component Greg KH
2020-01-06 18:58 ` [PATCH 3/3] iscsi: Fail session and connection on transport registration failure Gabriel Krisman Bertazi
2020-01-14 15:06 ` [PATCH 0/3] drivers base: transport component error propagation Greg KH
2020-01-16 3:56 ` Martin K. Petersen
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=20200106185817.640331-3-krisman@collabora.com \
--to=krisman@collabora.com \
--cc=cleech@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jejb@linux.ibm.com \
--cc=kernel@collabora.com \
--cc=lduncan@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=open-iscsi@googlegroups.com \
--cc=rafael@kernel.org \
/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