Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: ioatdma: make sysfs attributes const

The ioat_sysfs_entry structures are never modified, mark them as
read-only.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260304-sysfs-const-ioat-v2-4-b9b82651219b@weissschuh.net
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Thomas Weißschuh and committed by
Vinod Koul
28c82997 81ca3ad0

+10 -10
+10 -10
drivers/dma/ioat/sysfs.c
··· 32 32 dma_has_cap(DMA_INTERRUPT, dma->cap_mask) ? " intr" : ""); 33 33 34 34 } 35 - static struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap); 35 + static const struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap); 36 36 37 37 static ssize_t version_show(struct dma_chan *c, char *page) 38 38 { ··· 42 42 return sprintf(page, "%d.%d\n", 43 43 ioat_dma->version >> 4, ioat_dma->version & 0xf); 44 44 } 45 - static struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version); 45 + static const struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version); 46 46 47 47 static ssize_t 48 48 ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page) 49 49 { 50 - struct ioat_sysfs_entry *entry; 50 + const struct ioat_sysfs_entry *entry; 51 51 struct ioatdma_chan *ioat_chan; 52 52 53 - entry = container_of(attr, struct ioat_sysfs_entry, attr); 53 + entry = container_of_const(attr, struct ioat_sysfs_entry, attr); 54 54 ioat_chan = container_of(kobj, struct ioatdma_chan, kobj); 55 55 56 56 if (!entry->show) ··· 62 62 ioat_attr_store(struct kobject *kobj, struct attribute *attr, 63 63 const char *page, size_t count) 64 64 { 65 - struct ioat_sysfs_entry *entry; 65 + const struct ioat_sysfs_entry *entry; 66 66 struct ioatdma_chan *ioat_chan; 67 67 68 - entry = container_of(attr, struct ioat_sysfs_entry, attr); 68 + entry = container_of_const(attr, struct ioat_sysfs_entry, attr); 69 69 ioat_chan = container_of(kobj, struct ioatdma_chan, kobj); 70 70 71 71 if (!entry->store) ··· 120 120 121 121 return sprintf(page, "%d\n", (1 << ioat_chan->alloc_order) & ~1); 122 122 } 123 - static struct ioat_sysfs_entry ring_size_attr = __ATTR_RO(ring_size); 123 + static const struct ioat_sysfs_entry ring_size_attr = __ATTR_RO(ring_size); 124 124 125 125 static ssize_t ring_active_show(struct dma_chan *c, char *page) 126 126 { ··· 129 129 /* ...taken outside the lock, no need to be precise */ 130 130 return sprintf(page, "%d\n", ioat_ring_active(ioat_chan)); 131 131 } 132 - static struct ioat_sysfs_entry ring_active_attr = __ATTR_RO(ring_active); 132 + static const struct ioat_sysfs_entry ring_active_attr = __ATTR_RO(ring_active); 133 133 134 134 static ssize_t intr_coalesce_show(struct dma_chan *c, char *page) 135 135 { ··· 154 154 return count; 155 155 } 156 156 157 - static struct ioat_sysfs_entry intr_coalesce_attr = __ATTR_RW(intr_coalesce); 157 + static const struct ioat_sysfs_entry intr_coalesce_attr = __ATTR_RW(intr_coalesce); 158 158 159 - static struct attribute *ioat_attrs[] = { 159 + static const struct attribute *const ioat_attrs[] = { 160 160 &ring_size_attr.attr, 161 161 &ring_active_attr.attr, 162 162 &ioat_cap_attr.attr,