tile-srom: allow the driver to be built as a module
authorChris Metcalf <cmetcalf@mellanox.com>
Mon, 7 Nov 2016 20:56:37 +0000 (15:56 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2016 14:18:56 +0000 (15:18 +0100)
The code was already configured that way, but the Kconfig
file didn't support requesting it.

A buglet caused a null pointer deref when unloading the
module, but this commit also corrects that issue.

Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/Kconfig
drivers/char/tile-srom.c

index dc4f35ad19d0601e86327901822c97c7cdcc8747..c17604f8c7c17a734f7328cdc1a6d5184269ea5d 100644 (file)
@@ -577,7 +577,7 @@ config DEVPORT
 source "drivers/s390/char/Kconfig"
 
 config TILE_SROM
-       bool "Character-device access via hypervisor to the Tilera SPI ROM"
+       tristate "Character-device access via hypervisor to the Tilera SPI ROM"
        depends on TILE
        default y
        ---help---
index 398800edb2cc643a34fd450ff317ae1316f39d11..3d4cca64b2d4b1c651a78836713b3f46ea6f3e3f 100644 (file)
@@ -312,7 +312,8 @@ ATTRIBUTE_GROUPS(srom_dev);
 
 static char *srom_devnode(struct device *dev, umode_t *mode)
 {
-       *mode = S_IRUGO | S_IWUSR;
+       if (mode)
+               *mode = 0644;
        return kasprintf(GFP_KERNEL, "srom/%s", dev_name(dev));
 }