Add sanity checks for cport_quiesce and cport_clear before invoking the callbacks as these function pointers are not required during the host device registration. This follows the logic implemented elsewhere for various other function pointers.
Signed-off-by: Jason Hrycay jhrycay@gmail.com --- drivers/staging/greybus/connection.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 833f83b..aa040b1 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -358,6 +358,9 @@ static int gb_connection_hd_cport_quiesce(struct gb_connection *connection) size_t peer_space; int ret;
+ if (!hd->driver->cport_quiesce) + return 0; + peer_space = sizeof(struct gb_operation_msg_hdr) + sizeof(struct gb_cport_shutdown_request);
@@ -381,6 +384,9 @@ static int gb_connection_hd_cport_clear(struct gb_connection *connection) struct gb_host_device *hd = connection->hd; int ret;
+ if (!hd->driver->cport_clear) + return 0; + ret = hd->driver->cport_clear(hd, connection->hd_cport_id); if (ret) { dev_err(&hd->dev, "%s: failed to clear host cport: %d\n",
On Tue, Dec 20, 2016 at 02:49:27PM -0600, Jason Hrycay wrote:
Add sanity checks for cport_quiesce and cport_clear before invoking the callbacks as these function pointers are not required during the host device registration. This follows the logic implemented elsewhere for various other function pointers.
Yeah, I allowed for some inconsistency here given that these callbacks are mandatory on our current platform.
No harm in checking this way though (well, at least as long as we remember to set the pointers).
Signed-off-by: Jason Hrycay jhrycay@gmail.com
Acked-by: Johan Hovold johan@kernel.org
Thanks, Johan
On Mon, Jan 02, 2017 at 02:54:37PM +0100, Johan Hovold wrote:
On Tue, Dec 20, 2016 at 02:49:27PM -0600, Jason Hrycay wrote:
Add sanity checks for cport_quiesce and cport_clear before invoking the callbacks as these function pointers are not required during the host device registration. This follows the logic implemented elsewhere for various other function pointers.
Yeah, I allowed for some inconsistency here given that these callbacks are mandatory on our current platform.
No harm in checking this way though (well, at least as long as we remember to set the pointers).
OK, makes sense. We ran into it while integrating the Motorola host-device stack into the latest version of greybus (we were previously forked from a version a year ago - wow time flies).
Signed-off-by: Jason Hrycay jhrycay@gmail.com
Acked-by: Johan Hovold johan@kernel.org
Thanks, Johan
-Jason
On Tue, Jan 03, 2017 at 01:46:09PM -0600, Jason Hrycay wrote:
On Mon, Jan 02, 2017 at 02:54:37PM +0100, Johan Hovold wrote:
On Tue, Dec 20, 2016 at 02:49:27PM -0600, Jason Hrycay wrote:
Add sanity checks for cport_quiesce and cport_clear before invoking the callbacks as these function pointers are not required during the host device registration. This follows the logic implemented elsewhere for various other function pointers.
Yeah, I allowed for some inconsistency here given that these callbacks are mandatory on our current platform.
No harm in checking this way though (well, at least as long as we remember to set the pointers).
OK, makes sense. We ran into it while integrating the Motorola host-device stack into the latest version of greybus (we were previously forked from a version a year ago - wow time flies).
Cool. Yeah, things changed quite a bit over the last year. Just let us know if you have any questions.
Johan