• Anatolij Gustschin's avatar
    fpga: altera-cvp: fix probing for multiple FPGAs on the bus · 30522a95
    Anatolij Gustschin authored
    Currently registering CvP managers works only for first probed CvP
    device, for all other devices it is refused due to duplicated chkcfg
    sysfs entry:
    
    fpga_manager fpga3: Altera CvP FPGA Manager @0000:0c:00.0 registered
    sysfs: cannot create duplicate filename '/bus/pci/drivers/altera-cvp/chkcfg'
    CPU: 0 PID: 3808 Comm: bash Tainted: G           O      4.19.0-custom+ #5
    Call Trace:
      dump_stack+0x46/0x5b
      sysfs_warn_dup+0x53/0x60
      sysfs_add_file_mode_ns+0x16d/0x180
      sysfs_create_file_ns+0x51/0x60
      altera_cvp_probe+0x16f/0x2a0 [altera_cvp]
      local_pci_probe+0x3f/0xa0
      ? pci_match_device+0xb1/0xf0
      pci_device_probe+0x116/0x170
      really_probe+0x21b/0x2c0
      driver_probe_device+0x4b/0xe0
      bind_store+0xcb/0x130
      kernfs_fop_write+0xfd/0x180
      __vfs_write+0x21/0x150
      ? selinux_file_permission+0xdc/0x130
      vfs_write+0xa8/0x1a0
      ? find_vma+0xd/0x60
      ksys_write+0x3d/0x90
      do_syscall_64+0x44/0xf0
      entry_SYSCALL_64_after_hwframe+0x44/0xa9
      ...
     altera-cvp 0000:0c:00.0: Can't create sysfs chkcfg file
     fpga_manager fpga3: fpga_mgr_unregister Altera CvP FPGA Manager @0000:0c:00.0
    
    Move chkcfg creation to module init as suggested by Alan.
    Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
    Acked-by: default avatarAlan Tull <atull@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    30522a95
altera-cvp.c 14.6 KB