summaryrefslogtreecommitdiff
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-04-27 21:53:57 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2023-04-27 21:53:57 +0300
commit556eb8b79190151506187bf0b16dda423c34d9a8 (patch)
tree76fe79cf977e03be1b70059eef3195b89fe39948 /drivers/media/usb
parent97b2ff294381d05e59294a931c4db55276470cb5 (diff)
parent046b6a171009e1ed9ede02194025e9ccd709beb2 (diff)
downloadlinux-556eb8b79190151506187bf0b16dda423c34d9a8.tar.xz
Merge tag 'driver-core-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH: "Here is the large set of driver core changes for 6.4-rc1. Once again, a busy development cycle, with lots of changes happening in the driver core in the quest to be able to move "struct bus" and "struct class" into read-only memory, a task now complete with these changes. This will make the future rust interactions with the driver core more "provably correct" as well as providing more obvious lifetime rules for all busses and classes in the kernel. The changes required for this did touch many individual classes and busses as many callbacks were changed to take const * parameters instead. All of these changes have been submitted to the various subsystem maintainers, giving them plenty of time to review, and most of them actually did so. Other than those changes, included in here are a small set of other things: - kobject logging improvements - cacheinfo improvements and updates - obligatory fw_devlink updates and fixes - documentation updates - device property cleanups and const * changes - firwmare loader dependency fixes. All of these have been in linux-next for a while with no reported problems" * tag 'driver-core-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (120 commits) device property: make device_property functions take const device * driver core: update comments in device_rename() driver core: Don't require dynamic_debug for initcall_debug probe timing firmware_loader: rework crypto dependencies firmware_loader: Strip off \n from customized path zram: fix up permission for the hot_add sysfs file cacheinfo: Add use_arch[|_cache]_info field/function arch_topology: Remove early cacheinfo error message if -ENOENT cacheinfo: Check cache properties are present in DT cacheinfo: Check sib_leaf in cache_leaves_are_shared() cacheinfo: Allow early level detection when DT/ACPI info is missing/broken cacheinfo: Add arm64 early level initializer implementation cacheinfo: Add arch specific early level initializer tty: make tty_class a static const structure driver core: class: remove struct class_interface * from callbacks driver core: class: mark the struct class in struct class_interface constant driver core: class: make class_register() take a const * driver core: class: mark class_release() as taking a const * driver core: remove incorrect comment for device_create* MIPS: vpe-cmp: remove module owner pointer from struct class usage. ...
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-main.c18
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-sysfs.c59
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-sysfs.h16
3 files changed, 29 insertions, 64 deletions
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-main.c b/drivers/media/usb/pvrusb2/pvrusb2-main.c
index ce4d566e4e5a..721dafd2c14b 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-main.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-main.c
@@ -16,9 +16,7 @@
#include "pvrusb2-context.h"
#include "pvrusb2-debug.h"
#include "pvrusb2-v4l2.h"
-#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
#include "pvrusb2-sysfs.h"
-#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
#define DRIVER_AUTHOR "Mike Isely <isely@pobox.com>"
#define DRIVER_DESC "Hauppauge WinTV-PVR-USB2 MPEG2 Encoder/Tuner"
@@ -36,10 +34,6 @@ int pvrusb2_debug = DEFAULT_DEBUG_MASK;
module_param_named(debug,pvrusb2_debug,int,S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(debug, "Debug trace mask");
-#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
-static struct pvr2_sysfs_class *class_ptr = NULL;
-#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
-
static void pvr_setup_attach(struct pvr2_context *pvr)
{
/* Create association with v4l layer */
@@ -48,9 +42,7 @@ static void pvr_setup_attach(struct pvr2_context *pvr)
/* Create association with dvb layer */
pvr2_dvb_create(pvr);
#endif
-#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
- pvr2_sysfs_create(pvr,class_ptr);
-#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
+ pvr2_sysfs_create(pvr);
}
static int pvr_probe(struct usb_interface *intf,
@@ -115,9 +107,7 @@ static int __init pvr_init(void)
return ret;
}
-#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
- class_ptr = pvr2_sysfs_class_create();
-#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
+ pvr2_sysfs_class_create();
ret = usb_register(&pvr_driver);
@@ -141,9 +131,7 @@ static void __exit pvr_exit(void)
pvr2_context_global_done();
-#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
- pvr2_sysfs_class_destroy(class_ptr);
-#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
+ pvr2_sysfs_class_destroy();
pvr2_trace(PVR2_TRACE_INIT,"pvr_exit complete");
}
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c
index 3e42e209be37..a8c0b513e58e 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c
@@ -66,10 +66,6 @@ struct pvr2_sysfs_ctl_item {
char name[80];
};
-struct pvr2_sysfs_class {
- struct class class;
-};
-
static ssize_t show_name(struct device *class_dev,
struct device_attribute *attr,
char *buf)
@@ -487,15 +483,6 @@ static void pvr2_sysfs_tear_down_controls(struct pvr2_sysfs *sfp)
}
-static void pvr2_sysfs_class_release(struct class *class)
-{
- struct pvr2_sysfs_class *clp;
- clp = container_of(class,struct pvr2_sysfs_class,class);
- pvr2_sysfs_trace("Destroying pvr2_sysfs_class id=%p",clp);
- kfree(clp);
-}
-
-
static void pvr2_sysfs_release(struct device *class_dev)
{
pvr2_sysfs_trace("Releasing class_dev id=%p",class_dev);
@@ -503,6 +490,12 @@ static void pvr2_sysfs_release(struct device *class_dev)
}
+static struct class pvr2_class = {
+ .name = "pvrusb2",
+ .dev_release = pvr2_sysfs_release,
+};
+
+
static void class_dev_destroy(struct pvr2_sysfs *sfp)
{
struct device *dev;
@@ -614,8 +607,7 @@ static ssize_t unit_number_show(struct device *class_dev,
}
-static void class_dev_create(struct pvr2_sysfs *sfp,
- struct pvr2_sysfs_class *class_ptr)
+static void class_dev_create(struct pvr2_sysfs *sfp)
{
struct usb_device *usb_dev;
struct device *class_dev;
@@ -628,7 +620,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
pvr2_sysfs_trace("Creating class_dev id=%p",class_dev);
- class_dev->class = &class_ptr->class;
+ class_dev->class = &pvr2_class;
dev_set_name(class_dev, "%s",
pvr2_hdw_get_device_identifier(sfp->channel.hdw));
@@ -753,47 +745,30 @@ static void pvr2_sysfs_internal_check(struct pvr2_channel *chp)
}
-struct pvr2_sysfs *pvr2_sysfs_create(struct pvr2_context *mp,
- struct pvr2_sysfs_class *class_ptr)
+void pvr2_sysfs_create(struct pvr2_context *mp)
{
struct pvr2_sysfs *sfp;
sfp = kzalloc(sizeof(*sfp),GFP_KERNEL);
- if (!sfp) return sfp;
+ if (!sfp)
+ return;
pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr2_sysfs id=%p",sfp);
pvr2_channel_init(&sfp->channel,mp);
sfp->channel.check_func = pvr2_sysfs_internal_check;
- class_dev_create(sfp,class_ptr);
- return sfp;
+ class_dev_create(sfp);
}
-
-struct pvr2_sysfs_class *pvr2_sysfs_class_create(void)
+void pvr2_sysfs_class_create(void)
{
- struct pvr2_sysfs_class *clp;
- clp = kzalloc(sizeof(*clp),GFP_KERNEL);
- if (!clp) return clp;
- pvr2_sysfs_trace("Creating and registering pvr2_sysfs_class id=%p",
- clp);
- clp->class.name = "pvrusb2";
- clp->class.class_release = pvr2_sysfs_class_release;
- clp->class.dev_release = pvr2_sysfs_release;
- if (class_register(&clp->class)) {
- pvr2_sysfs_trace(
- "Registration failed for pvr2_sysfs_class id=%p",clp);
- kfree(clp);
- clp = NULL;
- }
- return clp;
+ if (class_register(&pvr2_class))
+ pvr2_sysfs_trace("Registration failed for pvr2_sysfs_class");
}
-void pvr2_sysfs_class_destroy(struct pvr2_sysfs_class *clp)
+void pvr2_sysfs_class_destroy(void)
{
- pvr2_sysfs_trace("Unregistering pvr2_sysfs_class id=%p", clp);
- if (clp)
- class_unregister(&clp->class);
+ class_unregister(&pvr2_class);
}
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.h b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.h
index ac580ff39b5f..375a5372e95c 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.h
+++ b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.h
@@ -10,13 +10,15 @@
#include <linux/sysfs.h>
#include "pvrusb2-context.h"
-struct pvr2_sysfs;
-struct pvr2_sysfs_class;
+#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
+void pvr2_sysfs_class_create(void);
+void pvr2_sysfs_class_destroy(void);
+void pvr2_sysfs_create(struct pvr2_context *mp);
+#else
+static inline void pvr2_sysfs_class_create(void) { }
+static inline void pvr2_sysfs_class_destroy(void) { }
+static inline void pvr2_sysfs_create(struct pvr2_context *mp) { }
+#endif
-struct pvr2_sysfs_class *pvr2_sysfs_class_create(void);
-void pvr2_sysfs_class_destroy(struct pvr2_sysfs_class *);
-
-struct pvr2_sysfs *pvr2_sysfs_create(struct pvr2_context *,
- struct pvr2_sysfs_class *);
#endif /* __PVRUSB2_SYSFS_H */