usb: convert to ctime accessor functions
authorJeff Layton <jlayton@kernel.org>
Wed, 5 Jul 2023 19:00:45 +0000 (15:00 -0400)
committerChristian Brauner <brauner@kernel.org>
Thu, 13 Jul 2023 08:28:03 +0000 (10:28 +0200)
In later patches, we're going to change how the inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Message-Id: <20230705190309.579783-18-jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
drivers/usb/core/devio.c
drivers/usb/gadget/function/f_fs.c
drivers/usb/gadget/legacy/inode.c

index 1a16a8bdea60bcd867c301d99084496d3adf6f73..4f68f6ef3cc17c2e0cc1524c4678219dd54501f5 100644 (file)
@@ -2642,21 +2642,21 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
                snoop(&dev->dev, "%s: CONTROL\n", __func__);
                ret = proc_control(ps, p);
                if (ret >= 0)
-                       inode->i_mtime = inode->i_ctime = current_time(inode);
+                       inode->i_mtime = inode_set_ctime_current(inode);
                break;
 
        case USBDEVFS_BULK:
                snoop(&dev->dev, "%s: BULK\n", __func__);
                ret = proc_bulk(ps, p);
                if (ret >= 0)
-                       inode->i_mtime = inode->i_ctime = current_time(inode);
+                       inode->i_mtime = inode_set_ctime_current(inode);
                break;
 
        case USBDEVFS_RESETEP:
                snoop(&dev->dev, "%s: RESETEP\n", __func__);
                ret = proc_resetep(ps, p);
                if (ret >= 0)
-                       inode->i_mtime = inode->i_ctime = current_time(inode);
+                       inode->i_mtime = inode_set_ctime_current(inode);
                break;
 
        case USBDEVFS_RESET:
@@ -2668,7 +2668,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
                snoop(&dev->dev, "%s: CLEAR_HALT\n", __func__);
                ret = proc_clearhalt(ps, p);
                if (ret >= 0)
-                       inode->i_mtime = inode->i_ctime = current_time(inode);
+                       inode->i_mtime = inode_set_ctime_current(inode);
                break;
 
        case USBDEVFS_GETDRIVER:
@@ -2695,7 +2695,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
                snoop(&dev->dev, "%s: SUBMITURB\n", __func__);
                ret = proc_submiturb(ps, p);
                if (ret >= 0)
-                       inode->i_mtime = inode->i_ctime = current_time(inode);
+                       inode->i_mtime = inode_set_ctime_current(inode);
                break;
 
 #ifdef CONFIG_COMPAT
@@ -2703,14 +2703,14 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
                snoop(&dev->dev, "%s: CONTROL32\n", __func__);
                ret = proc_control_compat(ps, p);
                if (ret >= 0)
-                       inode->i_mtime = inode->i_ctime = current_time(inode);
+                       inode->i_mtime = inode_set_ctime_current(inode);
                break;
 
        case USBDEVFS_BULK32:
                snoop(&dev->dev, "%s: BULK32\n", __func__);
                ret = proc_bulk_compat(ps, p);
                if (ret >= 0)
-                       inode->i_mtime = inode->i_ctime = current_time(inode);
+                       inode->i_mtime = inode_set_ctime_current(inode);
                break;
 
        case USBDEVFS_DISCSIGNAL32:
@@ -2722,7 +2722,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
                snoop(&dev->dev, "%s: SUBMITURB32\n", __func__);
                ret = proc_submiturb_compat(ps, p);
                if (ret >= 0)
-                       inode->i_mtime = inode->i_ctime = current_time(inode);
+                       inode->i_mtime = inode_set_ctime_current(inode);
                break;
 
        case USBDEVFS_IOCTL32:
index f41a385a5c421adbdeee11f1f010fb3a885a0b30..6e9ef35a43a7ba45c95420f2765ea04ce8d096eb 100644 (file)
@@ -1377,7 +1377,7 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
        inode = new_inode(sb);
 
        if (inode) {
-               struct timespec64 ts = current_time(inode);
+               struct timespec64 ts = inode_set_ctime_current(inode);
 
                inode->i_ino     = get_next_ino();
                inode->i_mode    = perms->mode;
@@ -1385,7 +1385,6 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
                inode->i_gid     = perms->gid;
                inode->i_atime   = ts;
                inode->i_mtime   = ts;
-               inode->i_ctime   = ts;
                inode->i_private = data;
                if (fops)
                        inode->i_fop = fops;
index 28249d0bf0629fa73acb9c8b9c963fad52b0b619..ce9e31f3d26bccce593dfb060cd3ab12579389e2 100644 (file)
@@ -1969,8 +1969,7 @@ gadgetfs_make_inode (struct super_block *sb,
                inode->i_mode = mode;
                inode->i_uid = make_kuid(&init_user_ns, default_uid);
                inode->i_gid = make_kgid(&init_user_ns, default_gid);
-               inode->i_atime = inode->i_mtime = inode->i_ctime
-                               = current_time(inode);
+               inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
                inode->i_private = data;
                inode->i_fop = fops;
        }