linux_spi.c: remove manual_mknod()
This was added in `282c24135` as a workaround for spi devices not
being created at chromeos_startup on Snow. We are removing it because
it's a brittle solution to a problem that should be solved by fixing
the device configuration instead.
No currently supported devices are known to have this issue. If anyone
still needs to manually create spi devices, they can still manually
create the device with mknod before running flashrom.
BUG=b:153598437
BRANCH=none
TEST=`sudo flashrom -p linux_spi` successfully runs on Hana
Signed-off-by: Nikolai Artemiev <nartemiev@chromium.org>
Change-Id: Ia5a111fc82224d924e2f625868d871ba770463ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/+/2206525
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: Edward O'Callaghan <quasisec@chromium.org>
Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
diff --git a/linux_spi.c b/linux_spi.c
index c91c846..aa19160 100644
--- a/linux_spi.c
+++ b/linux_spi.c
@@ -129,39 +129,6 @@
return NULL;
}
-/*
- * This is used when /dev/spidevX.Y is not created yet, for example, when
- * udev is not started.
- */
-static int manual_mknod(const char *dev)
-{
- char cmd[256];
-
- msg_pdbg("Creating SPI device node %s...\n", dev);
- strcpy(cmd, "modprobe spidev");
- msg_pdbg("CMD: [%s]\n", cmd);
- if (system(cmd)) {
- msg_perr("%s: failed to run '%s': %s\n", __func__,
- cmd, strerror(errno));
- return -1;
- }
- snprintf(cmd, sizeof(cmd), "mknod %s c %d 0", dev, SPIDEV_MAJOR);
- msg_pdbg("CMD: [%s]\n", cmd);
- if (system(cmd)) {
- msg_perr("%s: failed to run '%s': %s\n", __func__,
- cmd, strerror(errno));
- return -1;
- }
-
- if ((fd = open(dev, O_RDWR)) == -1) {
- msg_perr("%s: failed to open %s: %s\n", __func__,
- dev, strerror(errno));
- }
-
- return fd;
-}
-
-
int linux_spi_init(void)
{
char *p, *endp, *dev;
@@ -199,12 +166,10 @@
msg_pdbg("Using device %s\n", dev);
if ((fd = open(dev, O_RDWR)) == -1) {
- msg_pdbg("%s: failed to open %s: %s\n", __func__,
+ msg_perr("%s: failed to open %s: %s\n", __func__,
dev, strerror(errno));
- if (manual_mknod(dev) == -1) { // global fd is effected.
- return 1;
- }
+ return 1;
}
if (register_shutdown(linux_spi_shutdown, NULL))