From: Mike Christie Date: Thu, 9 Mar 2017 08:42:08 +0000 (-0600) Subject: tcmu: add helper to check if dev was configured X-Git-Tag: v4.1.12-105.0.20170622_2100~10 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7444277f600fa3a1f7bd161d41a81fb73e25eca0;p=users%2Fjedix%2Flinux-maple.git tcmu: add helper to check if dev was configured This adds a helper to check if the dev was configured. It will be used in the next patch to prevent updates to some config settings after the device has been setup. Signed-off-by: Mike Christie Signed-off-by: Nicholas Bellinger Orabug: 25395066 (cherry picked from commit 972c7f167974fa41ea8a2eed4b857cc59f59c42c) Signed-off-by: Kyle Fortin Reviewed-by: Shan Hai Conflicts: drivers/target/target_core_user.c --- diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 26b8fc38300f..25d44b753d24 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -990,6 +990,11 @@ static int tcmu_check_and_free_pending_cmd(struct tcmu_cmd *cmd) return -EINVAL; } +static bool tcmu_dev_configured(struct tcmu_dev *udev) +{ + return udev->uio_info.uio_dev ? true : false; +} + static void tcmu_free_device(struct se_device *dev) { struct tcmu_dev *udev = TCMU_DEV(dev); @@ -1011,8 +1016,7 @@ static void tcmu_free_device(struct se_device *dev) spin_unlock_irq(&udev->commands_lock); WARN_ON(!all_expired); - /* Device was configured */ - if (udev->uio_info.uio_dev) { + if (tcmu_dev_configured(udev)) { tcmu_netlink_event(TCMU_CMD_REMOVED_DEVICE, udev->uio_info.name, udev->uio_info.uio_dev->minor);