[LEDE-DEV] [PATCH] uci/file: replace mktemp() with mkstemp()

2017-09-16 Thread Maxim Gorbachyov
Because mktemp() is evil.

Signed-off-by: Maxim Gorbachyov 
---
 file.c | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/file.c b/file.c
index 494c649..ad0355b 100644
--- a/file.c
+++ b/file.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "uci.h"
 #include "uci_internal.h"
@@ -725,8 +726,8 @@ static void uci_file_commit(struct uci_context *ctx, struct 
uci_package **packag
char *name = NULL;
char *path = NULL;
char *filename = NULL;
-   struct stat statbuf;
bool do_rename = false;
+   int fd;
 
if (!p->path) {
if (overwrite)
@@ -772,18 +773,20 @@ static void uci_file_commit(struct uci_context *ctx, 
struct uci_package **packag
goto done;
}
 
-   if (!mktemp(filename))
-   *filename = 0;
+   fd = mkstemp(filename);
+   if (fd == -1)
+   UCI_THROW(ctx, UCI_ERR_IO);
 
-   if (!*filename) {
-   free(filename);
+   if ((flock(fd, LOCK_EX) < 0) && (errno != ENOSYS))
+   UCI_THROW(ctx, UCI_ERR_IO);
+
+   if (lseek(fd, 0, SEEK_SET) < 0)
UCI_THROW(ctx, UCI_ERR_IO);
-   }
 
-   if ((stat(filename, ) == 0) && ((statbuf.st_mode & S_IFMT) != 
S_IFREG))
+   f2 = fdopen(fd, "w+");
+   if (!f2)
UCI_THROW(ctx, UCI_ERR_IO);
 
-   f2 = uci_open_stream(ctx, filename, p->path, SEEK_SET, true, true);
uci_export(ctx, f2, p, false);
 
fflush(f2);
-- 
2.14.1


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] kernel: update to 3.18.71

2017-09-16 Thread Florian Fainelli
Delete a bunch of fixes that are already included.
Refresh patches.
Compile-tested on malta/mipsel
Runtime-tested on malta/mipsel

Signed-off-by: Florian Fainelli 
---
 include/kernel-version.mk  |  4 +-
 .../pending-3.18/002-phy_drivers_backport.patch| 56 +++---
 .../041-mtd-bcm47xxpart-backports-from-3.20.patch  |  2 +-
 .../044-backport-m25p80-jedec-probe.patch  |  2 +-
 ...070-bgmac-register-napi-before-the-device.patch |  6 +-
 ...evice-initialization-on-Northstar-SoCs-co.patch | 40 --
 ...03-bgmac-implement-scatter-gather-support.patch |  2 +-
 ...eset-enable-Ethernet-core-before-using-it.patch |  6 +-
 ...trie-Push-rcu_read_lock-unlock-to-callers.patch |  2 +-
 ..._fragment-fix-headroom-tests-and-skb-leak.patch |  8 +-
 ...-overlayfs-fallback-to-readonly-when-full.patch |  2 +-
 ...up_flags-FOLL_WRITE-games-from-__get_user.patch | 90 --
 ...gnore-__arch_swab-16-32-64-when-using-MIP.patch | 53 -
 ...part-limit-scanned-flash-area-on-BCM47XX-.patch | 33 
 ...m47xxpart-don-t-fail-because-of-bit-flips.patch |  4 +-
 ...upport_for_moving_ndp_to_end_of_ncm_frame.patch | 22 +++---
 ...-usb-ehci-orion-fix-probe-for-GENERIC_PHY.patch | 35 -
 ...l-Add-support-for-Quectel-EC20-Mini-PCIe-.patch |  4 +-
 ...n-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch |  6 +-
 .../pending-3.18/201-extra_optimization.patch  |  4 +-
 .../generic/pending-3.18/204-module_strip.patch| 16 ++--
 .../550-ubifs-symlink-xattr-support.patch  |  2 +-
 .../pending-3.18/630-packet_socket_type.patch  | 16 ++--
 .../pending-3.18/653-disable_netlink_trim.patch|  8 +-
 .../pending-3.18/655-increase_skb_pad.patch|  2 +-
 .../656-skb_reduce_truesize-helper.patch   |  2 +-
 .../666-Add-support-for-MAP-E-FMRs-mesh-mode.patch | 26 +++
 ...ed-source-specific-default-route-handling.patch |  4 +-
 ...jecting-with-source-address-failed-policy.patch | 20 ++---
 ...80-NET-skip-GRO-for-foreign-MAC-addresses.patch | 14 ++--
 .../generic/pending-3.18/701-phy_extension.patch   |  2 +-
 .../704-phy-no-genphy-soft-reset.patch | 29 ---
 .../710-phy-add-mdio_register_board_info.patch |  2 +-
 .../generic/pending-3.18/721-phy_packets.patch |  8 +-
 .../pending-3.18/773-bgmac-add-srab-switch.patch   |  4 +-
 .../811-pci_disable_usb_common_quirks.patch|  8 +-
 .../pending-3.18/901-debloat_sock_diag.patch   |  2 +-
 .../generic/pending-3.18/902-debloat_proc.patch|  2 +-
 .../pending-3.18/997-device_tree_cmdline.patch |  2 +-
 39 files changed, 133 insertions(+), 417 deletions(-)
 delete mode 100644 
target/linux/generic/pending-3.18/072-bgmac-fix-device-initialization-on-Northstar-SoCs-co.patch
 delete mode 100644 
target/linux/generic/pending-3.18/097-mm-remove-gup_flags-FOLL_WRITE-games-from-__get_user.patch
 delete mode 100644 
target/linux/generic/pending-3.18/133-MIPS-UAPI-Ignore-__arch_swab-16-32-64-when-using-MIP.patch
 delete mode 100644 
target/linux/generic/pending-3.18/141-mtd-bcm47xxpart-limit-scanned-flash-area-on-BCM47XX-.patch
 delete mode 100644 
target/linux/generic/pending-3.18/191-usb-ehci-orion-fix-probe-for-GENERIC_PHY.patch
 delete mode 100644 
target/linux/generic/pending-3.18/704-phy-no-genphy-soft-reset.patch

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 0fd915adc21d..3f799ab29888 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -2,11 +2,11 @@
 
 LINUX_RELEASE?=1
 
-LINUX_VERSION-3.18 = .43
+LINUX_VERSION-3.18 = .71
 LINUX_VERSION-4.4 = .88
 LINUX_VERSION-4.9 = .49
 
-LINUX_KERNEL_HASH-3.18.43 = 
1236e8123a6ce537d5029232560966feed054ae31776fe8481dd7d18cdd5492c
+LINUX_KERNEL_HASH-3.18.71 = 
5abc9778ad44ce02ed6c8ab52ece8a21c6d20d21f6ed8a19287b4a38a50c1240
 LINUX_KERNEL_HASH-4.4.88 = 
144fe8dd773ec317fa06109b8d7bd04141bf1941daa03799fb4f437919b4
 LINUX_KERNEL_HASH-4.9.49 = 
57ecdcf180b56356b2e15264ca567a8fcd9eec993fc70286bec3bd0005e791fb
 
diff --git a/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch 
b/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch
index c97c759e7ee8..63071c999745 100644
--- a/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch
+++ b/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/phy/adm6996.c
 +++ b/drivers/net/phy/adm6996.c
-@@ -287,7 +287,7 @@ static u16
+@@ -289,7 +289,7 @@ static u16
  adm6996_read_mii_reg(struct adm6996_priv *priv, enum admreg reg)
  {
struct phy_device *phydev = priv->priv;
@@ -9,7 +9,7 @@
  
return bus->read(bus, PHYADDR(reg));
  }
-@@ -296,7 +296,7 @@ static void
+@@ -298,7 +298,7 @@ static void
  adm6996_write_mii_reg(struct adm6996_priv *priv, enum admreg reg, u16 val)
  {
struct phy_device *phydev = priv->priv;
@@ -18,7 +18,7 @@
  
bus->write(bus, PHYADDR(reg), val);
  }
-@@ -1019,13 +1019,13 @@ static int 

Re: [LEDE-DEV] [LEDE-DEV, v2, 01/11] at91: Renaming subtarget sama5d3 to sama5

2017-09-16 Thread Florian Fainelli


On 09/13/2017 11:51 AM, Sandeep Sheriker Mallikarjun wrote:
> Renaming at91 subtarget sama5d3 to sama5 and using at91-sama5d3_xplained
> as a target device in sama5 subtarget.This will enable to add other
> sama5d2 & sama5d4 target devices in sama5 subtraget.This will avoid
> code duplication when sama5d2 & sama5d4 added as different subtarget.

The whole patch series looks fine, but please include a cover letter in
the future that summarizes the changes that occurred between v1 and v2.
-- 
Florian

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 4/4] ramips/RT5350F-OLINUXINO(-EVB) dts: enable ttyS1

2017-09-16 Thread Martin Blumenstingl via Lede-dev
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
Hi Zoltan,

On Wed, Sep 6, 2017 at 2:25 AM, Zoltan Gyarmati
 wrote:
> Dear John,
>
> thanks for the review, see my response inline
>
> On 08/29/2017 09:37 AM, John Crispin wrote:
>> Hi,
>>
>> comment inline
>>
>>
>> On 26/08/17 21:54, Zoltan Gyarmati wrote:
>>>   The RT5350F's second UART pins are available on the base module and on
>>> the EVB as well, so enable it in the device tree.
>>>   Additionaly, the uartlite@c00 and uart@500 nodes swapped in
>>> rt5350.dtsi
>>> to keep the serial console as ttyS0.
>>>
>>> Signed-off-by: Zoltan Gyarmati 
>>> ---
>>>   target/linux/ramips/dts/RT5350F-OLINUXINO.dtsi | 11 +-
>>>   target/linux/ramips/dts/rt5350.dtsi| 30
>>> +-
>>>   2 files changed, 25 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/target/linux/ramips/dts/RT5350F-OLINUXINO.dtsi
>>> b/target/linux/ramips/dts/RT5350F-OLINUXINO.dtsi
>>> index 955a13cddd..1632f3c085 100644
>>> --- a/target/linux/ramips/dts/RT5350F-OLINUXINO.dtsi
>>> +++ b/target/linux/ramips/dts/RT5350F-OLINUXINO.dtsi
>>> @@ -46,9 +46,13 @@
>>>{
>>>   state_default: pinctrl0 {
>>>   gpio {
>>> -ralink,group = "jtag", "rgmii", "mdio", "uartf";
>>> +ralink,group = "jtag", "rgmii", "mdio";
>>>   ralink,function = "gpio";
>>>   };
>>> +uartf_gpio {
>>> +ralink,group = "uartf";
>>> +ralink,function = "gpio uartf";
>>> +};
>>>   };
>>>   };
>>>   @@ -77,3 +81,8 @@
>>>{
>>>   status = "okay";
>>>   };
>>> +
>>> + {
>>> +status = "okay";
>>> +};
>>> +
>>> diff --git a/target/linux/ramips/dts/rt5350.dtsi
>>> b/target/linux/ramips/dts/rt5350.dtsi
>>> index a92c113043..f027e17d9d 100644
>>> --- a/target/linux/ramips/dts/rt5350.dtsi
>>> +++ b/target/linux/ramips/dts/rt5350.dtsi
>>> @@ -83,21 +83,6 @@
>>>   interrupts = <3>;
>>>   };
>>>   -uart: uart@500 {
>>> -compatible = "ralink,rt5350-uart", "ralink,rt2880-uart",
>>> "ns16550a";
>>> -reg = <0x500 0x100>;
>>> -
>>> -resets = < 12>;
>>> -reset-names = "uart";
>>> -
>>> -interrupt-parent = <>;
>>> -interrupts = <5>;
>>> -
>>> -reg-shift = <2>;
>>> -
>>> -status = "disabled";
>>> -};
>>> -
>>>   gpio0: gpio@600 {
>>>   compatible = "ralink,rt5350-gpio", "ralink,rt2880-gpio";
>>>   reg = <0x600 0x34>;
>>> @@ -221,6 +206,21 @@
>>>   reg-shift = <2>;
>>>   };
>>>   +uart: uart@500 {
>>> +compatible = "ralink,rt5350-uart", "ralink,rt2880-uart",
>>> "ns16550a";
>>> +reg = <0x500 0x100>;
>>> +
>>> +resets = < 12>;
>>> +reset-names = "uart";
>>> +
>>> +interrupt-parent = <>;
>>> +interrupts = <5>;
>>> +
>>> +reg-shift = <2>;
>>> +
>>> +status = "disabled";
>>> +};
>>
>> moving the node makes no sense. the change is a no-op. please remove
>> it and update the patch description
>
>
> I've just double checked it now, and the order of these nodes does
> change the order of the serial port numbering, therefore it's not no-op.
> Please see the relevant sections from both dmesg outputs:
have you tried using the devicetree aliases node (see [0] for example)
to configure the order?

>  With original rt5350.dtsi, uart@500 enabled
> [ 0.565407] gpio-export gpio_export: 3 gpio(s) exported
> [ 0.576247] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
> [ 0.590942] console [ttyS0] disabled
> [0.598130] 1500.uart: ttyS0 at MMIO 0x1500 (irq = 13,
> base_baud = 250) is a Palmchip BK-3103
> [0.617160] console [ttyS0] enabled
> [0.630939] bootconsole [early0] disabled
> [0.647968] 1c00.uartlite: ttyS1 at MMIO 0x1c00 (irq = 20,
> base_baud = 250) is a Palmchip BK-3103
> [0.680207] spi spi0.0: force spi mode3
>
>  With swapped items in rt5350.dtsi
> [0.564356] gpio-export gpio_export: 3 gpio(s) exported
> [0.575201] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
> [0.590006] console [ttyS0] disabled
> [0.597183] 1c00.uartlite: ttyS0 at MMIO 0x1c00 (irq = 20,
> base_baud = 250) is a Palmchip BK-3103
> [0.616906] console [ttyS0] enabled
> [0.630692] bootconsole [early0] disabled
> [0.647677] 1500.uart: ttyS1 at MMIO 0x1500 (irq = 13,
> base_baud = 250) is a Palmchip BK-3103
> [0.678972] spi spi0.0: force spi mode3
>
> Consequently (given that ttyS0 is configured as console in the kernel
> command line),
> the serial console moves to