The ADC in the JZ4740 can work either in high-precision mode with a 2.5V
range, or in low-precision mode with a 7.5V range. The code in place in
this driver will select the proper scale according to the maximum
voltage of the battery.
The JZ4770 however only has one mode, with a 6.6V range. If only one
scale is available, there's no need to change it (and nothing to change
it to), and trying to do so will fail with -EINVAL.
Fixes: fb24ccfbe1e0 ("power: supply: add Ingenic JZ47xx battery driver.")
Signed-off-by: Paul Cercueil <paul(a)crapouillou.net>
Cc: stable(a)vger.kernel.org
---
Notes:
v2: Rebased on v5.4-rc7
v3: Move code after check for max scale voltage
drivers/power/supply/ingenic-battery.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/power/supply/ingenic-battery.c b/drivers/power/supply/ingenic-battery.c
index 35816d4b3012..2748715c4c75 100644
--- a/drivers/power/supply/ingenic-battery.c
+++ b/drivers/power/supply/ingenic-battery.c
@@ -100,10 +100,17 @@ static int ingenic_battery_set_scale(struct ingenic_battery *bat)
return -EINVAL;
}
- return iio_write_channel_attribute(bat->channel,
- scale_raw[best_idx],
- scale_raw[best_idx + 1],
- IIO_CHAN_INFO_SCALE);
+ /* Only set scale if there is more than one (fractional) entry */
+ if (scale_len > 2) {
+ ret = iio_write_channel_attribute(bat->channel,
+ scale_raw[best_idx],
+ scale_raw[best_idx + 1],
+ IIO_CHAN_INFO_SCALE);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
}
static enum power_supply_property ingenic_battery_properties[] = {
--
2.24.0
This is the start of the stable review cycle for the 5.3.18 release.
There are 25 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Note, this is the LAST 5.3.y kernel to be released, after this one, it
will be end-of-life. You should have moved to the 5.4.y series already
by now.
Responses should be made by Thu, 19 Dec 2019 20:08:42 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.3.18-rc1…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.3.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 5.3.18-rc1
Jonathan Lemon <jonathan.lemon(a)gmail.com>
xdp: obtain the mem_id mutex before trying to remove an entry.
Jonathan Lemon <jonathan.lemon(a)gmail.com>
page_pool: do not release pool until inflight == 0.
Eran Ben Elisha <eranbe(a)mellanox.com>
net/mlx5e: Fix TXQ indices to be sequential
Martin Varghese <martin.varghese(a)nokia.com>
net: Fixed updating of ethertype in skb_mpls_push()
Taehee Yoo <ap420073(a)gmail.com>
hsr: fix a NULL pointer dereference in hsr_dev_xmit()
Martin Varghese <martin.varghese(a)nokia.com>
Fixed updating of ethertype in function skb_mpls_pop
Cong Wang <xiyou.wangcong(a)gmail.com>
gre: refetch erspan header from skb->data after pskb_may_pull()
Guillaume Nault <gnault(a)redhat.com>
tcp: Protect accesses to .ts_recent_stamp with {READ,WRITE}_ONCE()
Guillaume Nault <gnault(a)redhat.com>
tcp: tighten acceptance of ACKs not matching a child socket
Guillaume Nault <gnault(a)redhat.com>
tcp: fix rejected syncookies due to stale timestamps
Sabrina Dubroca <sd(a)queasysnail.net>
net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup
Sabrina Dubroca <sd(a)queasysnail.net>
net: ipv6: add net argument to ip6_dst_lookup_flow
Huy Nguyen <huyn(a)mellanox.com>
net/mlx5e: Query global pause state before setting prio2buffer
Taehee Yoo <ap420073(a)gmail.com>
tipc: fix ordering of tipc module init and exit routine
Eric Dumazet <edumazet(a)google.com>
tcp: md5: fix potential overestimation of TCP option space
Aaron Conole <aconole(a)redhat.com>
openvswitch: support asymmetric conntrack
Valentin Vidic <vvidic(a)valentin-vidic.from.hr>
net/tls: Fix return values to avoid ENOTSUPP
Mian Yousaf Kaukab <ykaukab(a)suse.de>
net: thunderx: start phy before starting autonegotiation
Jouni Hogander <jouni.hogander(a)unikie.com>
net-sysfs: Call dev_hold always in netdev_queue_add_kobject
Dust Li <dust.li(a)linux.alibaba.com>
net: sched: fix dump qlen for sch_mq/sch_mqprio with NOLOCK subqueues
Grygorii Strashko <grygorii.strashko(a)ti.com>
net: ethernet: ti: cpsw: fix extra rx interrupt
Alexander Lobakin <alobakin(a)dlink.ru>
net: dsa: fix flow dissection on Tx path
Nikolay Aleksandrov <nikolay(a)cumulusnetworks.com>
net: bridge: deny dev_set_mac_address() when unregistering
Vladyslav Tarasiuk <vladyslavt(a)mellanox.com>
mqprio: Fix out-of-bounds access in mqprio_dump
Eric Dumazet <edumazet(a)google.com>
inet: protect against too small mtu values.
-------------
Diffstat:
Makefile | 4 +-
drivers/infiniband/core/addr.c | 7 +-
drivers/infiniband/sw/rxe/rxe_net.c | 8 +-
drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +-
.../ethernet/mellanox/mlx5/core/en/port_buffer.c | 27 ++++-
.../net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 8 +-
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 31 ++----
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +-
drivers/net/ethernet/ti/cpsw.c | 2 +-
drivers/net/geneve.c | 4 +-
drivers/net/vxlan.c | 8 +-
include/linux/netdevice.h | 5 +
include/linux/skbuff.h | 5 +-
include/linux/time.h | 13 +++
include/net/ip.h | 5 +
include/net/ipv6.h | 2 +-
include/net/ipv6_stubs.h | 6 +-
include/net/page_pool.h | 52 +++------
include/net/tcp.h | 27 +++--
include/net/xdp_priv.h | 4 -
include/trace/events/xdp.h | 19 +---
net/bridge/br_device.c | 6 +
net/core/dev.c | 3 +-
net/core/flow_dissector.c | 5 +-
net/core/lwt_bpf.c | 4 +-
net/core/net-sysfs.c | 7 +-
net/core/page_pool.c | 122 +++++++++++++--------
net/core/skbuff.c | 10 +-
net/core/xdp.c | 117 +++++++-------------
net/dccp/ipv6.c | 6 +-
net/hsr/hsr_device.c | 9 +-
net/ipv4/devinet.c | 5 -
net/ipv4/gre_demux.c | 2 +-
net/ipv4/ip_output.c | 13 ++-
net/ipv4/tcp_output.c | 5 +-
net/ipv6/addrconf_core.c | 11 +-
net/ipv6/af_inet6.c | 4 +-
net/ipv6/datagram.c | 2 +-
net/ipv6/inet6_connection_sock.c | 4 +-
net/ipv6/ip6_output.c | 8 +-
net/ipv6/raw.c | 2 +-
net/ipv6/syncookies.c | 2 +-
net/ipv6/tcp_ipv6.c | 4 +-
net/l2tp/l2tp_ip6.c | 2 +-
net/mpls/af_mpls.c | 7 +-
net/openvswitch/actions.c | 6 +-
net/openvswitch/conntrack.c | 11 ++
net/sched/act_mpls.c | 7 +-
net/sched/sch_mq.c | 1 +
net/sched/sch_mqprio.c | 3 +-
net/sctp/ipv6.c | 4 +-
net/tipc/core.c | 29 ++---
net/tipc/udp_media.c | 9 +-
net/tls/tls_device.c | 8 +-
net/tls/tls_main.c | 4 +-
net/tls/tls_sw.c | 8 +-
tools/testing/selftests/net/tls.c | 8 +-
60 files changed, 375 insertions(+), 332 deletions(-)