summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-05-05 11:31:34 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-05-05 11:31:34 +0200
commite63f9a85226b1520a5881da7e7fef82446deb879 (patch)
treecdc1d521e9338d24af1c0a98c6177587a771b33e /drivers
parent337bf5f7eb243fb909f045950e8b6f402e5a0f8e (diff)
parentb876c2b7394f9d5258e6b73f684741c88fa41f23 (diff)
downloadbarebox-e63f9a85226b1520a5881da7e7fef82446deb879.tar.gz
barebox-e63f9a85226b1520a5881da7e7fef82446deb879.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'drivers')
-rw-r--r--drivers/eeprom/at24.c4
-rw-r--r--drivers/eeprom/at25.c2
-rw-r--r--drivers/mci/mci-core.c11
-rw-r--r--drivers/net/dm9k.c2
-rw-r--r--drivers/net/rtl8139.c4
-rw-r--r--drivers/of/base.c14
-rw-r--r--drivers/of/of_net.c20
-rw-r--r--drivers/spi/spi.c8
-rw-r--r--drivers/usb/gadget/f_fastboot.c3
-rw-r--r--drivers/video/of_display_timing.c19
10 files changed, 30 insertions, 57 deletions
diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c
index 1227286fbe..050a35aed8 100644
--- a/drivers/eeprom/at24.c
+++ b/drivers/eeprom/at24.c
@@ -454,6 +454,10 @@ static int at24_probe(struct device_d *dev)
at24->cdev.size = chip.byte_len;
writable = !(chip.flags & AT24_FLAG_READONLY);
+
+ if (of_get_property(dev->device_node, "read-only", NULL))
+ writable = 0;
+
if (writable) {
unsigned write_max = chip.page_size;
diff --git a/drivers/eeprom/at25.c b/drivers/eeprom/at25.c
index 1caaebd371..9f16f964a8 100644
--- a/drivers/eeprom/at25.c
+++ b/drivers/eeprom/at25.c
@@ -290,7 +290,7 @@ static int at25_np_to_chip(struct device_d *dev,
val);
return -ENODEV;
}
- if (of_find_property(np, "read-only", NULL))
+ if (of_property_read_bool(np, "read-only"))
chip->flags |= EE_READONLY;
}
return 0;
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index b173a173b1..3da1c261a9 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -984,7 +984,7 @@ static int mci_startup_sd(struct mci *mci)
mci_setup_cmd(&cmd, SD_CMD_APP_SET_BUS_WIDTH, 2, MMC_RSP_R1);
err = mci_send_cmd(mci, &cmd, NULL);
if (err) {
- dev_dbg(&mci->dev, "Changing SD bus width failed: %d\n", err);
+ dev_warn(&mci->dev, "Changing SD bus width failed: %d\n", err);
/* TODO continue with 1 bit? */
return err;
}
@@ -1041,8 +1041,11 @@ static int mci_startup_mmc(struct mci *mci)
err = mci_switch(mci, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_BUS_WIDTH,
ext_csd_bits[idx]);
- if (err)
+ if (err) {
+ if (idx == 0)
+ dev_warn(&mci->dev, "Changing MMC bus width failed: %d\n", err);
continue;
+ }
mci_set_bus_width(mci, bus_widths[idx]);
@@ -1051,7 +1054,7 @@ static int mci_startup_mmc(struct mci *mci)
break;
}
- return 0;
+ return err;
}
/**
@@ -1693,7 +1696,7 @@ static int mci_card_probe(struct mci *mci)
rc = mci_startup(mci);
if (rc) {
- dev_dbg(&mci->dev, "Card's startup fails with %d\n", rc);
+ dev_warn(&mci->dev, "Card's startup fails with %d\n", rc);
goto on_error;
}
diff --git a/drivers/net/dm9k.c b/drivers/net/dm9k.c
index 25f08602f6..c99d188ded 100644
--- a/drivers/net/dm9k.c
+++ b/drivers/net/dm9k.c
@@ -737,7 +737,7 @@ static int dm9000_parse_dt(struct device_d *dev, struct dm9k *priv)
if (!IS_ENABLED(CONFIG_OFDEVICE) || !np)
return -ENODEV;
- if (of_find_property(np, "davicom,no-eeprom", NULL)) {
+ if (of_property_read_bool(np, "davicom,no-eeprom")) {
priv->srom = 0;
} else {
priv->srom = 1;
diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index a9eb865358..cfa34a2f2a 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -492,10 +492,6 @@ static int rtl8139_eth_send(struct eth_device *edev, void *packet,
return 0;
}
-static const u16 rtl8139_intr_mask =
- PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver |
- TxErr | TxOK | RxErr | RxOK;
-
static int rtl8139_eth_rx(struct eth_device *edev)
{
struct rtl8139_priv *priv = edev->priv;
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 6632f4d9dd..c9bdd91810 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1090,19 +1090,14 @@ int of_property_write_u8_array(struct device_node *np,
size_t sz)
{
struct property *prop = of_find_property(np, propname, NULL);
- u8 *val;
if (prop)
of_delete_property(prop);
- prop = of_new_property(np, propname, NULL, sizeof(*val) * sz);
+ prop = of_new_property(np, propname, values, sizeof(*values) * sz);
if (!prop)
return -ENOMEM;
- val = prop->value;
- while (sz--)
- *val++ = *values++;
-
return 0;
}
@@ -1807,12 +1802,7 @@ struct property *of_new_property(struct device_node *node, const char *name,
struct property *prop;
prop = xzalloc(sizeof(*prop));
- prop->name = strdup(name);
- if (!prop->name) {
- free(prop);
- return NULL;
- }
-
+ prop->name = xstrdup(name);
prop->length = len;
prop->value = xzalloc(len);
diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
index 086573fc1a..9b54e44674 100644
--- a/drivers/of/of_net.c
+++ b/drivers/of/of_net.c
@@ -77,19 +77,15 @@ EXPORT_SYMBOL_GPL(of_get_phy_mode);
*/
const void *of_get_mac_address(struct device_node *np)
{
- struct property *pp;
+ const void *p;
+ int len, i;
+ const char *str[] = { "mac-address", "local-mac-address", "address" };
- pp = of_find_property(np, "mac-address", NULL);
- if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
- return pp->value;
-
- pp = of_find_property(np, "local-mac-address", NULL);
- if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
- return pp->value;
-
- pp = of_find_property(np, "address", NULL);
- if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
- return pp->value;
+ for (i = 0; i < ARRAY_SIZE(str); i++) {
+ p = of_get_property(np, str[i], &len);
+ if (p && (len == 6) && is_valid_ether_addr(p))
+ return p;
+ }
return NULL;
}
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 99412b07e2..5650098a0a 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -118,13 +118,13 @@ static void spi_of_register_slaves(struct spi_master *master)
chip.name = xstrdup(n->name);
chip.bus_num = master->bus_num;
/* Mode (clock phase/polarity/etc.) */
- if (of_find_property(n, "spi-cpha", NULL))
+ if (of_property_read_bool(n, "spi-cpha"))
chip.mode |= SPI_CPHA;
- if (of_find_property(n, "spi-cpol", NULL))
+ if (of_property_read_bool(n, "spi-cpol"))
chip.mode |= SPI_CPOL;
- if (of_find_property(n, "spi-cs-high", NULL))
+ if (of_property_read_bool(n, "spi-cs-high"))
chip.mode |= SPI_CS_HIGH;
- if (of_find_property(n, "spi-3wire", NULL))
+ if (of_property_read_bool(n, "spi-3wire"))
chip.mode |= SPI_3WIRE;
of_property_read_u32(n, "spi-max-frequency",
&chip.max_speed_hz);
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index ef5f7ec6e0..598637619d 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -758,6 +758,9 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd
copy:
ret = copy_file(FASTBOOT_TMPFILE, filename, 1);
+
+ unlink(FASTBOOT_TMPFILE);
+
if (ret) {
fastboot_tx_print(f_fb, "FAILwrite partition: %s", strerror(-ret));
return;
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c
index 6a5bf62a36..20f9354a18 100644
--- a/drivers/video/of_display_timing.c
+++ b/drivers/video/of_display_timing.c
@@ -188,22 +188,3 @@ entryfail:
return NULL;
}
EXPORT_SYMBOL_GPL(of_get_display_timings);
-
-/**
- * of_display_timings_exist - check if a display-timings node is provided
- * @np: device_node with the timing
- **/
-int of_display_timings_exist(struct device_node *np)
-{
- struct device_node *timings_np;
-
- if (!np)
- return -EINVAL;
-
- timings_np = of_parse_phandle(np, "display-timings", 0);
- if (!timings_np)
- return -EINVAL;
-
- return 1;
-}
-EXPORT_SYMBOL_GPL(of_display_timings_exist);