Skip to content

Commit

Permalink
tcmu: add helper to check if dev was configured
Browse files Browse the repository at this point in the history
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 <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Mike Christie authored and Nicholas Bellinger committed Mar 18, 2017
1 parent 760bf57 commit 972c7f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/target/target_core_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,11 @@ static void tcmu_dev_call_rcu(struct rcu_head *p)
kfree(udev);
}

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);
Expand All @@ -1019,8 +1024,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);

Expand Down

0 comments on commit 972c7f1

Please sign in to comment.