Skip to content

Commit 79d891c

Browse files
committed
Merge tag 'linux-can-next-for-4.16-20180105' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next
Marc Kleine-Budde says: ==================== pull-request: can-next 2017-12-01,Re: pull-request: can-next this is a pull request of 7 patches for net-next/master. All patches are by me. Patch 6 is for the "can_raw" protocol and add error checking to the bind() function. All other patches clean up the coding style and remove unused parameters in various CAN drivers and infrastructure. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 5138eb9 + ff847ee commit 79d891c

File tree

12 files changed

+32
-34
lines changed

12 files changed

+32
-34
lines changed

drivers/net/can/rx-offload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ int can_rx_offload_add_timestamp(struct net_device *dev, struct can_rx_offload *
256256
weight = offload->mb_first - offload->mb_last;
257257
}
258258

259-
return can_rx_offload_init_queue(dev, offload, weight);;
259+
return can_rx_offload_init_queue(dev, offload, weight);
260260
}
261261
EXPORT_SYMBOL_GPL(can_rx_offload_add_timestamp);
262262

drivers/net/can/slcan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ static void slc_sync(void)
508508
}
509509

510510
/* Find a free SLCAN channel, and link in this `tty' line. */
511-
static struct slcan *slc_alloc(dev_t line)
511+
static struct slcan *slc_alloc(void)
512512
{
513513
int i;
514514
char name[IFNAMSIZ];
@@ -583,7 +583,7 @@ static int slcan_open(struct tty_struct *tty)
583583

584584
/* OK. Find a free SLCAN channel to use. */
585585
err = -ENFILE;
586-
sl = slc_alloc(tty_devnum(tty));
586+
sl = slc_alloc();
587587
if (sl == NULL)
588588
goto err_exit;
589589

drivers/net/can/spi/mcp251x.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,7 @@ static int mcp251x_do_set_bittiming(struct net_device *net)
612612
return 0;
613613
}
614614

615-
static int mcp251x_setup(struct net_device *net, struct mcp251x_priv *priv,
616-
struct spi_device *spi)
615+
static int mcp251x_setup(struct net_device *net, struct spi_device *spi)
617616
{
618617
mcp251x_do_set_bittiming(net);
619618

@@ -775,7 +774,7 @@ static void mcp251x_restart_work_handler(struct work_struct *ws)
775774
mutex_lock(&priv->mcp_lock);
776775
if (priv->after_suspend) {
777776
mcp251x_hw_reset(spi);
778-
mcp251x_setup(net, priv, spi);
777+
mcp251x_setup(net, spi);
779778
if (priv->after_suspend & AFTER_SUSPEND_RESTART) {
780779
mcp251x_set_normal_mode(spi);
781780
} else if (priv->after_suspend & AFTER_SUSPEND_UP) {
@@ -971,7 +970,7 @@ static int mcp251x_open(struct net_device *net)
971970
mcp251x_open_clean(net);
972971
goto open_unlock;
973972
}
974-
ret = mcp251x_setup(net, priv, spi);
973+
ret = mcp251x_setup(net, spi);
975974
if (ret) {
976975
mcp251x_open_clean(net);
977976
goto open_unlock;

drivers/net/can/usb/gs_usb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static struct gs_tx_context *gs_get_tx_context(struct gs_can *dev,
243243
return NULL;
244244
}
245245

246-
static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev)
246+
static int gs_cmd_reset(struct gs_can *gsdev)
247247
{
248248
struct gs_device_mode *dm;
249249
struct usb_interface *intf = gsdev->iface;
@@ -709,7 +709,7 @@ static int gs_can_close(struct net_device *netdev)
709709
atomic_set(&dev->active_tx_urbs, 0);
710710

711711
/* reset the device */
712-
rc = gs_cmd_reset(parent, dev);
712+
rc = gs_cmd_reset(dev);
713713
if (rc < 0)
714714
netdev_warn(netdev, "Couldn't shutdown device (err=%d)", rc);
715715

drivers/net/can/usb/peak_usb/pcan_usb_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time)
158158
* post received skb after having set any hw timestamp
159159
*/
160160
int peak_usb_netif_rx(struct sk_buff *skb,
161-
struct peak_time_ref *time_ref, u32 ts_low, u32 ts_high)
161+
struct peak_time_ref *time_ref, u32 ts_low)
162162
{
163163
struct skb_shared_hwtstamps *hwts = skb_hwtstamps(skb);
164164

drivers/net/can/usb/peak_usb/pcan_usb_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
153153
void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
154154
void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *tv);
155155
int peak_usb_netif_rx(struct sk_buff *skb,
156-
struct peak_time_ref *time_ref, u32 ts_low, u32 ts_high);
156+
struct peak_time_ref *time_ref, u32 ts_low);
157157
void peak_usb_async_complete(struct urb *urb);
158158
void peak_usb_restart_complete(struct peak_usb_device *dev);
159159

drivers/net/can/usb/peak_usb/pcan_usb_fd.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,7 @@ static int pcan_usb_fd_decode_canmsg(struct pcan_usb_fd_if *usb_if,
513513
else
514514
memcpy(cfd->data, rm->d, cfd->len);
515515

516-
peak_usb_netif_rx(skb, &usb_if->time_ref,
517-
le32_to_cpu(rm->ts_low), le32_to_cpu(rm->ts_high));
516+
peak_usb_netif_rx(skb, &usb_if->time_ref, le32_to_cpu(rm->ts_low));
518517

519518
netdev->stats.rx_packets++;
520519
netdev->stats.rx_bytes += cfd->len;
@@ -574,8 +573,7 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if,
574573
if (!skb)
575574
return -ENOMEM;
576575

577-
peak_usb_netif_rx(skb, &usb_if->time_ref,
578-
le32_to_cpu(sm->ts_low), le32_to_cpu(sm->ts_high));
576+
peak_usb_netif_rx(skb, &usb_if->time_ref, le32_to_cpu(sm->ts_low));
579577

580578
netdev->stats.rx_packets++;
581579
netdev->stats.rx_bytes += cf->can_dlc;
@@ -617,8 +615,7 @@ static int pcan_usb_fd_decode_overrun(struct pcan_usb_fd_if *usb_if,
617615
cf->can_id |= CAN_ERR_CRTL;
618616
cf->data[1] |= CAN_ERR_CRTL_RX_OVERFLOW;
619617

620-
peak_usb_netif_rx(skb, &usb_if->time_ref,
621-
le32_to_cpu(ov->ts_low), le32_to_cpu(ov->ts_high));
618+
peak_usb_netif_rx(skb, &usb_if->time_ref, le32_to_cpu(ov->ts_low));
622619

623620
netdev->stats.rx_over_errors++;
624621
netdev->stats.rx_errors++;

include/net/netns/can.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <linux/spinlock.h>
1010

11-
struct dev_rcv_lists;
11+
struct can_dev_rcv_lists;
1212
struct s_stats;
1313
struct s_pstats;
1414

@@ -28,7 +28,7 @@ struct netns_can {
2828
#endif
2929

3030
/* receive filters subscribed for 'all' CAN devices */
31-
struct dev_rcv_lists *can_rx_alldev_list;
31+
struct can_dev_rcv_lists *can_rx_alldev_list;
3232
spinlock_t can_rcvlists_lock;
3333
struct timer_list can_stattimer;/* timer for statistics update */
3434
struct s_stats *can_stats; /* packet statistics */

net/can/af_can.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,13 @@ EXPORT_SYMBOL(can_send);
321321
* af_can rx path
322322
*/
323323

324-
static struct dev_rcv_lists *find_dev_rcv_lists(struct net *net,
324+
static struct can_dev_rcv_lists *find_dev_rcv_lists(struct net *net,
325325
struct net_device *dev)
326326
{
327327
if (!dev)
328328
return net->can.can_rx_alldev_list;
329329
else
330-
return (struct dev_rcv_lists *)dev->ml_priv;
330+
return (struct can_dev_rcv_lists *)dev->ml_priv;
331331
}
332332

333333
/**
@@ -381,7 +381,7 @@ static unsigned int effhash(canid_t can_id)
381381
* Reduced can_id to have a preprocessed filter compare value.
382382
*/
383383
static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask,
384-
struct dev_rcv_lists *d)
384+
struct can_dev_rcv_lists *d)
385385
{
386386
canid_t inv = *can_id & CAN_INV_FILTER; /* save flag before masking */
387387

@@ -464,7 +464,7 @@ int can_rx_register(struct net *net, struct net_device *dev, canid_t can_id,
464464
{
465465
struct receiver *r;
466466
struct hlist_head *rl;
467-
struct dev_rcv_lists *d;
467+
struct can_dev_rcv_lists *d;
468468
struct s_pstats *can_pstats = net->can.can_pstats;
469469
int err = 0;
470470

@@ -542,7 +542,7 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id,
542542
struct receiver *r = NULL;
543543
struct hlist_head *rl;
544544
struct s_pstats *can_pstats = net->can.can_pstats;
545-
struct dev_rcv_lists *d;
545+
struct can_dev_rcv_lists *d;
546546

547547
if (dev && dev->type != ARPHRD_CAN)
548548
return;
@@ -615,7 +615,7 @@ static inline void deliver(struct sk_buff *skb, struct receiver *r)
615615
r->matches++;
616616
}
617617

618-
static int can_rcv_filter(struct dev_rcv_lists *d, struct sk_buff *skb)
618+
static int can_rcv_filter(struct can_dev_rcv_lists *d, struct sk_buff *skb)
619619
{
620620
struct receiver *r;
621621
int matches = 0;
@@ -682,7 +682,7 @@ static int can_rcv_filter(struct dev_rcv_lists *d, struct sk_buff *skb)
682682

683683
static void can_receive(struct sk_buff *skb, struct net_device *dev)
684684
{
685-
struct dev_rcv_lists *d;
685+
struct can_dev_rcv_lists *d;
686686
struct net *net = dev_net(dev);
687687
struct s_stats *can_stats = net->can.can_stats;
688688
int matches;
@@ -829,7 +829,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg,
829829
void *ptr)
830830
{
831831
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
832-
struct dev_rcv_lists *d;
832+
struct can_dev_rcv_lists *d;
833833

834834
if (dev->type != ARPHRD_CAN)
835835
return NOTIFY_DONE;
@@ -874,7 +874,7 @@ static int can_pernet_init(struct net *net)
874874
{
875875
spin_lock_init(&net->can.can_rcvlists_lock);
876876
net->can.can_rx_alldev_list =
877-
kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL);
877+
kzalloc(sizeof(struct can_dev_rcv_lists), GFP_KERNEL);
878878
if (!net->can.can_rx_alldev_list)
879879
goto out;
880880
net->can.can_stats = kzalloc(sizeof(struct s_stats), GFP_KERNEL);
@@ -920,7 +920,7 @@ static void can_pernet_exit(struct net *net)
920920
rcu_read_lock();
921921
for_each_netdev_rcu(net, dev) {
922922
if (dev->type == ARPHRD_CAN && dev->ml_priv) {
923-
struct dev_rcv_lists *d = dev->ml_priv;
923+
struct can_dev_rcv_lists *d = dev->ml_priv;
924924

925925
BUG_ON(d->entries);
926926
kfree(d);

net/can/af_can.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct receiver {
6767
enum { RX_ERR, RX_ALL, RX_FIL, RX_INV, RX_MAX };
6868

6969
/* per device receive filters linked at dev->ml_priv */
70-
struct dev_rcv_lists {
70+
struct can_dev_rcv_lists {
7171
struct hlist_head rx[RX_MAX];
7272
struct hlist_head rx_sff[CAN_SFF_RCV_ARRAY_SZ];
7373
struct hlist_head rx_eff[CAN_EFF_RCV_ARRAY_SZ];

net/can/proc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ static const struct file_operations can_version_proc_fops = {
338338

339339
static inline void can_rcvlist_proc_show_one(struct seq_file *m, int idx,
340340
struct net_device *dev,
341-
struct dev_rcv_lists *d)
341+
struct can_dev_rcv_lists *d)
342342
{
343343
if (!hlist_empty(&d->rx[idx])) {
344344
can_print_recv_banner(m);
@@ -353,7 +353,7 @@ static int can_rcvlist_proc_show(struct seq_file *m, void *v)
353353
/* double cast to prevent GCC warning */
354354
int idx = (int)(long)PDE_DATA(m->file->f_inode);
355355
struct net_device *dev;
356-
struct dev_rcv_lists *d;
356+
struct can_dev_rcv_lists *d;
357357
struct net *net = m->private;
358358

359359
seq_printf(m, "\nreceive list '%s':\n", rx_list_name[idx]);
@@ -417,7 +417,7 @@ static inline void can_rcvlist_proc_show_array(struct seq_file *m,
417417
static int can_rcvlist_sff_proc_show(struct seq_file *m, void *v)
418418
{
419419
struct net_device *dev;
420-
struct dev_rcv_lists *d;
420+
struct can_dev_rcv_lists *d;
421421
struct net *net = m->private;
422422

423423
/* RX_SFF */
@@ -461,7 +461,7 @@ static const struct file_operations can_rcvlist_sff_proc_fops = {
461461
static int can_rcvlist_eff_proc_show(struct seq_file *m, void *v)
462462
{
463463
struct net_device *dev;
464-
struct dev_rcv_lists *d;
464+
struct can_dev_rcv_lists *d;
465465
struct net *net = m->private;
466466

467467
/* RX_EFF */

net/can/raw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,8 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len)
401401

402402
if (len < sizeof(*addr))
403403
return -EINVAL;
404+
if (addr->can_family != AF_CAN)
405+
return -EINVAL;
404406

405407
lock_sock(sk);
406408

0 commit comments

Comments
 (0)