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.

fpga: dfl: use driver core functions, not sysfs ones.

This is a driver, do not call "raw" sysfs functions, instead call driver
core ones. Specifically convert the use of sysfs_create_files() and
sysfs_remove_files() to use device_add_groups() and
device_remove_groups()

Cc: Wu Hao <hao.wu@intel.com>
Cc: Alan Tull <atull@kernel.org>
Cc: Moritz Fischer <mdf@kernel.org>
Cc: linux-fpga@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20190704055645.GA15471@kroah.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+12 -9
+8 -6
drivers/fpga/dfl-afu-main.c
··· 141 141 } 142 142 static DEVICE_ATTR_RO(id); 143 143 144 - static const struct attribute *port_hdr_attrs[] = { 144 + static struct attribute *port_hdr_attrs[] = { 145 145 &dev_attr_id.attr, 146 146 NULL, 147 147 }; 148 + ATTRIBUTE_GROUPS(port_hdr); 148 149 149 150 static int port_hdr_init(struct platform_device *pdev, 150 151 struct dfl_feature *feature) ··· 154 153 155 154 port_reset(pdev); 156 155 157 - return sysfs_create_files(&pdev->dev.kobj, port_hdr_attrs); 156 + return device_add_groups(&pdev->dev, port_hdr_groups); 158 157 } 159 158 160 159 static void port_hdr_uinit(struct platform_device *pdev, ··· 162 161 { 163 162 dev_dbg(&pdev->dev, "PORT HDR UInit.\n"); 164 163 165 - sysfs_remove_files(&pdev->dev.kobj, port_hdr_attrs); 164 + device_remove_groups(&pdev->dev, port_hdr_groups); 166 165 } 167 166 168 167 static long ··· 215 214 } 216 215 static DEVICE_ATTR_RO(afu_id); 217 216 218 - static const struct attribute *port_afu_attrs[] = { 217 + static struct attribute *port_afu_attrs[] = { 219 218 &dev_attr_afu_id.attr, 220 219 NULL 221 220 }; 221 + ATTRIBUTE_GROUPS(port_afu); 222 222 223 223 static int port_afu_init(struct platform_device *pdev, 224 224 struct dfl_feature *feature) ··· 236 234 if (ret) 237 235 return ret; 238 236 239 - return sysfs_create_files(&pdev->dev.kobj, port_afu_attrs); 237 + return device_add_groups(&pdev->dev, port_afu_groups); 240 238 } 241 239 242 240 static void port_afu_uinit(struct platform_device *pdev, ··· 244 242 { 245 243 dev_dbg(&pdev->dev, "PORT AFU UInit.\n"); 246 244 247 - sysfs_remove_files(&pdev->dev.kobj, port_afu_attrs); 245 + device_remove_groups(&pdev->dev, port_afu_groups); 248 246 } 249 247 250 248 static const struct dfl_feature_ops port_afu_ops = {
+4 -3
drivers/fpga/dfl-fme-main.c
··· 72 72 } 73 73 static DEVICE_ATTR_RO(bitstream_metadata); 74 74 75 - static const struct attribute *fme_hdr_attrs[] = { 75 + static struct attribute *fme_hdr_attrs[] = { 76 76 &dev_attr_ports_num.attr, 77 77 &dev_attr_bitstream_id.attr, 78 78 &dev_attr_bitstream_metadata.attr, 79 79 NULL, 80 80 }; 81 + ATTRIBUTE_GROUPS(fme_hdr); 81 82 82 83 static int fme_hdr_init(struct platform_device *pdev, 83 84 struct dfl_feature *feature) ··· 90 89 dev_dbg(&pdev->dev, "FME cap %llx.\n", 91 90 (unsigned long long)readq(base + FME_HDR_CAP)); 92 91 93 - ret = sysfs_create_files(&pdev->dev.kobj, fme_hdr_attrs); 92 + ret = device_add_groups(&pdev->dev, fme_hdr_groups); 94 93 if (ret) 95 94 return ret; 96 95 ··· 101 100 struct dfl_feature *feature) 102 101 { 103 102 dev_dbg(&pdev->dev, "FME HDR UInit.\n"); 104 - sysfs_remove_files(&pdev->dev.kobj, fme_hdr_attrs); 103 + device_remove_groups(&pdev->dev, fme_hdr_groups); 105 104 } 106 105 107 106 static const struct dfl_feature_ops fme_hdr_ops = {