• Jon Smirl's avatar
    [PATCH] PCI: add PCI ROMs to sysfs · f6d55344
    Jon Smirl authored
    Linus has requested that the sysfs rom attribute be changed to require
    enabling before it works. echo "0" to the attribute to disable,
    echoing anything else enables the rom output. The concern is that
    something like a file browser could inadvertently read the attribute
    and change the state of the hardware without the user's knowledge.
    
    The attached patch includes the previous patch plus the enabling logic.
    
    [root@smirl 0000:02:02.0]#
    [root@smirl 0000:02:02.0]# cat rom
    cat: rom: Invalid argument
    [root@smirl 0000:02:02.0]# echo "1" >rom
    [root@smirl 0000:02:02.0]# hexdump -C -n 20 rom
    00000000  55 aa 60 e9 d6 01 00 00  00 00 00 00 00 00 00 00  |U.`.............|
    00000010  00 00 00 00                                       |....|
    00000014
    [root@smirl 0000:02:02.0]# echo "0" >rom
    [root@smirl 0000:02:02.0]# hexdump -C -n 20 rom
    hexdump: rom: Invalid argument
    [root@smirl 0000:02:02.0]#
    Signed-off-by: default avatarJon Smirl <jonsmirl@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
    f6d55344
pci-sysfs.c 7.07 KB