mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
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>
This commit is contained in:
committed by
Vinod Koul
parent
81ca3ad09b
commit
28c829977f
@@ -32,7 +32,7 @@ static ssize_t cap_show(struct dma_chan *c, char *page)
|
||||
dma_has_cap(DMA_INTERRUPT, dma->cap_mask) ? " intr" : "");
|
||||
|
||||
}
|
||||
static struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap);
|
||||
static const struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap);
|
||||
|
||||
static ssize_t version_show(struct dma_chan *c, char *page)
|
||||
{
|
||||
@@ -42,15 +42,15 @@ static ssize_t version_show(struct dma_chan *c, char *page)
|
||||
return sprintf(page, "%d.%d\n",
|
||||
ioat_dma->version >> 4, ioat_dma->version & 0xf);
|
||||
}
|
||||
static struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version);
|
||||
static const struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version);
|
||||
|
||||
static ssize_t
|
||||
ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
|
||||
{
|
||||
struct ioat_sysfs_entry *entry;
|
||||
const struct ioat_sysfs_entry *entry;
|
||||
struct ioatdma_chan *ioat_chan;
|
||||
|
||||
entry = container_of(attr, struct ioat_sysfs_entry, attr);
|
||||
entry = container_of_const(attr, struct ioat_sysfs_entry, attr);
|
||||
ioat_chan = container_of(kobj, struct ioatdma_chan, kobj);
|
||||
|
||||
if (!entry->show)
|
||||
@@ -62,10 +62,10 @@ static ssize_t
|
||||
ioat_attr_store(struct kobject *kobj, struct attribute *attr,
|
||||
const char *page, size_t count)
|
||||
{
|
||||
struct ioat_sysfs_entry *entry;
|
||||
const struct ioat_sysfs_entry *entry;
|
||||
struct ioatdma_chan *ioat_chan;
|
||||
|
||||
entry = container_of(attr, struct ioat_sysfs_entry, attr);
|
||||
entry = container_of_const(attr, struct ioat_sysfs_entry, attr);
|
||||
ioat_chan = container_of(kobj, struct ioatdma_chan, kobj);
|
||||
|
||||
if (!entry->store)
|
||||
@@ -120,7 +120,7 @@ static ssize_t ring_size_show(struct dma_chan *c, char *page)
|
||||
|
||||
return sprintf(page, "%d\n", (1 << ioat_chan->alloc_order) & ~1);
|
||||
}
|
||||
static struct ioat_sysfs_entry ring_size_attr = __ATTR_RO(ring_size);
|
||||
static const struct ioat_sysfs_entry ring_size_attr = __ATTR_RO(ring_size);
|
||||
|
||||
static ssize_t ring_active_show(struct dma_chan *c, char *page)
|
||||
{
|
||||
@@ -129,7 +129,7 @@ static ssize_t ring_active_show(struct dma_chan *c, char *page)
|
||||
/* ...taken outside the lock, no need to be precise */
|
||||
return sprintf(page, "%d\n", ioat_ring_active(ioat_chan));
|
||||
}
|
||||
static struct ioat_sysfs_entry ring_active_attr = __ATTR_RO(ring_active);
|
||||
static const struct ioat_sysfs_entry ring_active_attr = __ATTR_RO(ring_active);
|
||||
|
||||
static ssize_t intr_coalesce_show(struct dma_chan *c, char *page)
|
||||
{
|
||||
@@ -154,9 +154,9 @@ size_t count)
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct ioat_sysfs_entry intr_coalesce_attr = __ATTR_RW(intr_coalesce);
|
||||
static const struct ioat_sysfs_entry intr_coalesce_attr = __ATTR_RW(intr_coalesce);
|
||||
|
||||
static struct attribute *ioat_attrs[] = {
|
||||
static const struct attribute *const ioat_attrs[] = {
|
||||
&ring_size_attr.attr,
|
||||
&ring_active_attr.attr,
|
||||
&ioat_cap_attr.attr,
|
||||
|
||||
Reference in New Issue
Block a user