linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* w1: coding style and checkpatch fixes
@ 2018-10-28 22:09 Steffen Vogel
  2018-10-28 22:09 ` [PATCH 1/9] w1: add SPDX identifiers Steffen Vogel
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Steffen Vogel @ 2018-10-28 22:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Evgeniy Polyakov

Hi,

This is my first series of patches for the Linux kernel.
I started by familiarizing myself with coding style and
satisfying my inner OCD by cleaning the 1-wire subsystem.

Steffen

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/9] w1: add SPDX identifiers
  2018-10-28 22:09 w1: coding style and checkpatch fixes Steffen Vogel
@ 2018-10-28 22:09 ` Steffen Vogel
  2018-10-28 22:09 ` [PATCH 2/9] w1: improve coding style by following strict 80 column line limit Steffen Vogel
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Steffen Vogel @ 2018-10-28 22:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Evgeniy Polyakov, Steffen Vogel

This satisfies a checkpatch warning and is the preferred
method for notating the license.

The SPDX identifier is a legally binding shorthand, which
can be used instead of the full boiler plate text.

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
 drivers/w1/masters/ds1wm.c     |  5 +----
 drivers/w1/masters/ds2482.c    |  7 ++-----
 drivers/w1/masters/ds2490.c    | 16 +---------------
 drivers/w1/masters/matrox_w1.c | 16 +---------------
 drivers/w1/masters/mxc_w1.c    | 10 +---------
 drivers/w1/masters/omap_hdq.c  |  7 ++-----
 drivers/w1/masters/w1-gpio.c   |  5 +----
 drivers/w1/slaves/w1_ds2405.c  | 12 +-----------
 drivers/w1/slaves/w1_ds2406.c  |  4 +---
 drivers/w1/slaves/w1_ds2408.c  |  4 +---
 drivers/w1/slaves/w1_ds2413.c  |  4 +---
 drivers/w1/slaves/w1_ds2423.c  | 15 +--------------
 drivers/w1/slaves/w1_ds2431.c  |  4 +---
 drivers/w1/slaves/w1_ds2433.c  |  4 +---
 drivers/w1/slaves/w1_ds2438.c  |  4 +---
 drivers/w1/slaves/w1_ds2780.c  |  6 +-----
 drivers/w1/slaves/w1_ds2781.c  |  6 +-----
 drivers/w1/slaves/w1_ds2805.c  |  4 +---
 drivers/w1/slaves/w1_ds28e04.c |  4 +---
 drivers/w1/slaves/w1_ds28e17.c |  4 +---
 drivers/w1/slaves/w1_smem.c    | 16 +---------------
 drivers/w1/slaves/w1_therm.c   | 16 +---------------
 drivers/w1/w1.c                | 11 +----------
 drivers/w1/w1_family.c         | 11 +----------
 drivers/w1/w1_int.c            | 11 +----------
 drivers/w1/w1_internal.h       | 11 +----------
 drivers/w1/w1_io.c             | 11 +----------
 drivers/w1/w1_netlink.c        | 11 +----------
 drivers/w1/w1_netlink.h        | 11 +----------
 29 files changed, 31 insertions(+), 219 deletions(-)

diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
index f661695fb589..83a991a3e3bd 100644
--- a/drivers/w1/masters/ds1wm.c
+++ b/drivers/w1/masters/ds1wm.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * 1-wire busmaster driver for DS1WM and ASICs with embedded DS1WMs
  * such as HP iPAQs (including h5xxx, h2200, and devices with ASIC3
@@ -5,10 +6,6 @@
  *
  * Copyright (c) 2004-2005, Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
  * Copyright (c) 2004-2007, Matt Reimer <mreimer@vpop.net>
- *
- * Use consistent with the GNU GPL is permitted,
- * provided that this copyright notice is
- * preserved in its entirety in all copies and derived works.
  */
 
 #include <linux/module.h>
diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c
index 8b5e598ffdb3..d9bb021eca7e 100644
--- a/drivers/w1/masters/ds2482.c
+++ b/drivers/w1/masters/ds2482.c
@@ -1,4 +1,5 @@
-/**
+// SPDX-License-Identifier: GPL-2.0
+/*
  * ds2482.c - provides i2c to w1-master bridge(s)
  * Copyright (C) 2005  Ben Gardner <bgardner@wabtec.com>
  *
@@ -7,10 +8,6 @@
  * There are two variations: -100 and -800, which have 1 or 8 1-wire ports.
  * The complete datasheet can be obtained from MAXIM's website at:
  *   http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4382
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
  */
 
 #include <linux/module.h>
diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
index 0f4ecfcdb549..7bd9862ef337 100644
--- a/drivers/w1/masters/ds2490.c
+++ b/drivers/w1/masters/ds2490.c
@@ -1,22 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  *	ds2490.c  USB to one wire bridge
  *
  * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include <linux/module.h>
diff --git a/drivers/w1/masters/matrox_w1.c b/drivers/w1/masters/matrox_w1.c
index d83d7c99d81d..be131c04ee63 100644
--- a/drivers/w1/masters/matrox_w1.c
+++ b/drivers/w1/masters/matrox_w1.c
@@ -1,22 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  *	matrox_w1.c
  *
  * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include <asm/types.h>
diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
index 50b46c4399ea..8168008e352e 100644
--- a/drivers/w1/masters/mxc_w1.c
+++ b/drivers/w1/masters/mxc_w1.c
@@ -1,15 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2005-2008 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2008 Luotao Fu, kernel@pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <linux/clk.h>
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index 83fc9aab34e8..39419a562388 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -1,13 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * drivers/w1/masters/omap_hdq.c
  *
  * Copyright (C) 2007,2012 Texas Instruments, Inc.
- *
- * This file is licensed under the terms of the GNU General Public License
- * version 2. This program is licensed "as is" without any warranty of any
- * kind, whether express or implied.
- *
  */
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
index 55e11bf8ebaf..110c04e5c9c4 100644
--- a/drivers/w1/masters/w1-gpio.c
+++ b/drivers/w1/masters/w1-gpio.c
@@ -1,11 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * w1-gpio - GPIO w1 bus master driver
  *
  * Copyright (C) 2007 Ville Syrjala <syrjala@sci.fi>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
  */
 
 #include <linux/init.h>
diff --git a/drivers/w1/slaves/w1_ds2405.c b/drivers/w1/slaves/w1_ds2405.c
index 42a1e81060ce..713f3db87324 100644
--- a/drivers/w1/slaves/w1_ds2405.c
+++ b/drivers/w1/slaves/w1_ds2405.c
@@ -1,19 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  *	w1_ds2405.c
  *
  * Copyright (c) 2017 Maciej S. Szmigiero <mail@maciej.szmigiero.name>
  * Based on w1_therm.c copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the therms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <linux/device.h>
diff --git a/drivers/w1/slaves/w1_ds2406.c b/drivers/w1/slaves/w1_ds2406.c
index fac266366ca3..7fdade7ee9b8 100644
--- a/drivers/w1/slaves/w1_ds2406.c
+++ b/drivers/w1/slaves/w1_ds2406.c
@@ -1,11 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * w1_ds2406.c - w1 family 12 (DS2406) driver
  * based on w1_ds2413.c by Mariusz Bialonczyk <manio@skyboo.net>
  *
  * Copyright (c) 2014 Scott Alfter <scott@alfter.us>
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/slaves/w1_ds2408.c b/drivers/w1/slaves/w1_ds2408.c
index b535d5ec35b6..ce8ee403e719 100644
--- a/drivers/w1/slaves/w1_ds2408.c
+++ b/drivers/w1/slaves/w1_ds2408.c
@@ -1,10 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  *	w1_ds2408.c - w1 family 29 (DS2408) driver
  *
  * Copyright (c) 2010 Jean-Francois Dagenais <dagenaisj@sonatest.com>
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/slaves/w1_ds2413.c b/drivers/w1/slaves/w1_ds2413.c
index 492e3d010321..6325785ccd8a 100644
--- a/drivers/w1/slaves/w1_ds2413.c
+++ b/drivers/w1/slaves/w1_ds2413.c
@@ -1,11 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * w1_ds2413.c - w1 family 3a (DS2413) driver
  * based on w1_ds2408.c by Jean-Francois Dagenais <dagenaisj@sonatest.com>
  *
  * Copyright (c) 2013 Mariusz Bialonczyk <manio@skyboo.net>
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/slaves/w1_ds2423.c b/drivers/w1/slaves/w1_ds2423.c
index 050407c53b16..910c2f9b01a0 100644
--- a/drivers/w1/slaves/w1_ds2423.c
+++ b/drivers/w1/slaves/w1_ds2423.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  *	w1_ds2423.c
  *
@@ -6,20 +7,6 @@
  * This driver will read and write the value of 4 counters to w1_slave file in
  * sys filesystem.
  * Inspired by the w1_therm and w1_ds2431 drivers.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the therms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/slaves/w1_ds2431.c b/drivers/w1/slaves/w1_ds2431.c
index 5adecd3face1..6fa7dc822f57 100644
--- a/drivers/w1/slaves/w1_ds2431.c
+++ b/drivers/w1/slaves/w1_ds2431.c
@@ -1,12 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * w1_ds2431.c - w1 family 2d (DS2431) driver
  *
  * Copyright (c) 2008 Bernhard Weirich <bernhard.weirich@riedel.net>
  *
  * Heavily inspired by w1_DS2433 driver from Ben Gardner <bgardner@wabtec.com>
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c
index 75ad70cfe8e8..798371ffd92f 100644
--- a/drivers/w1/slaves/w1_ds2433.c
+++ b/drivers/w1/slaves/w1_ds2433.c
@@ -1,10 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  *	w1_ds2433.c - w1 family 23 (DS2433) driver
  *
  * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c
index bf641a191d07..8e1a2bbd6d0c 100644
--- a/drivers/w1/slaves/w1_ds2438.c
+++ b/drivers/w1/slaves/w1_ds2438.c
@@ -1,10 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * 1-Wire implementation for the ds2438 chip
  *
  * Copyright (c) 2017 Mariusz Bialonczyk <manio@skyboo.net>
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c
index a60528131154..5b2babe2d57b 100644
--- a/drivers/w1/slaves/w1_ds2780.c
+++ b/drivers/w1/slaves/w1_ds2780.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * 1-Wire implementation for the ds2780 chip
  *
@@ -6,11 +7,6 @@
  * Author: Clifton Barnes <cabarnes@indesign-llc.com>
  *
  * Based on w1-ds2760 driver
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/slaves/w1_ds2781.c b/drivers/w1/slaves/w1_ds2781.c
index 645be6e0b24a..3031b8b7ea85 100644
--- a/drivers/w1/slaves/w1_ds2781.c
+++ b/drivers/w1/slaves/w1_ds2781.c
@@ -1,14 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * 1-Wire implementation for the ds2781 chip
  *
  * Author: Renata Sayakhova <renata@oktetlabs.ru>
  *
  * Based on w1-ds2780 driver
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/slaves/w1_ds2805.c b/drivers/w1/slaves/w1_ds2805.c
index 29348d283a65..cc2af1da77c3 100644
--- a/drivers/w1/slaves/w1_ds2805.c
+++ b/drivers/w1/slaves/w1_ds2805.c
@@ -1,10 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * w1_ds2805 - w1 family 0d (DS28E05) driver
  *
  * Copyright (c) 2016 Andrew Worsley amworsley@gmail.com
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/slaves/w1_ds28e04.c b/drivers/w1/slaves/w1_ds28e04.c
index ec234b846eb3..641e69f47c3e 100644
--- a/drivers/w1/slaves/w1_ds28e04.c
+++ b/drivers/w1/slaves/w1_ds28e04.c
@@ -1,10 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  *	w1_ds28e04.c - w1 family 1C (DS28E04) driver
  *
  * Copyright (c) 2012 Markus Franke <franke.m@sebakmt.com>
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/slaves/w1_ds28e17.c b/drivers/w1/slaves/w1_ds28e17.c
index e78b63ea4daf..fa26a1f1a6e4 100644
--- a/drivers/w1/slaves/w1_ds28e17.c
+++ b/drivers/w1/slaves/w1_ds28e17.c
@@ -1,10 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  *	w1_ds28e17.c - w1 family 19 (DS28E17) driver
  *
  * Copyright (c) 2016 Jan Kandziora <jjj@gmx.de>
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2. See the file COPYING for more details.
  */
 
 #include <linux/crc16.h>
diff --git a/drivers/w1/slaves/w1_smem.c b/drivers/w1/slaves/w1_smem.c
index e556b0caff71..88cd893e6619 100644
--- a/drivers/w1/slaves/w1_smem.c
+++ b/drivers/w1/slaves/w1_smem.c
@@ -1,22 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  *	w1_smem.c
  *
  * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the smems of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include <asm/types.h>
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 3c350dfbcd0b..d741b56422a9 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -1,22 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  *	w1_therm.c
  *
  * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the therms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include <asm/types.h>
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 890c038c25f8..2c64655b603c 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <linux/delay.h>
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
index f14ab0b340b5..ee90a6733472 100644
--- a/drivers/w1/w1_family.c
+++ b/drivers/w1/w1_family.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <linux/spinlock.h>
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index 1c776178f598..507eea535d43 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <linux/kernel.h>
diff --git a/drivers/w1/w1_internal.h b/drivers/w1/w1_internal.h
index 1623e2fdccc7..977c68fac431 100644
--- a/drivers/w1/w1_internal.h
+++ b/drivers/w1/w1_internal.h
@@ -1,15 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #ifndef __W1_H
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
index 0364d3329c52..bc7d1f7a1222 100644
--- a/drivers/w1/w1_io.c
+++ b/drivers/w1/w1_io.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <asm/io.h>
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c
index f2f099caeb77..0f2c6ed94b0f 100644
--- a/drivers/w1/w1_netlink.c
+++ b/drivers/w1/w1_netlink.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2003 Evgeniy Polyakov <zbr@ioremap.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <linux/slab.h>
diff --git a/drivers/w1/w1_netlink.h b/drivers/w1/w1_netlink.h
index f876772c0fb4..08cbf08f3649 100644
--- a/drivers/w1/w1_netlink.h
+++ b/drivers/w1/w1_netlink.h
@@ -1,15 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (c) 2003 Evgeniy Polyakov <zbr@ioremap.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #ifndef __W1_NETLINK_H
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/9] w1: improve coding style by following strict 80 column line limit
  2018-10-28 22:09 w1: coding style and checkpatch fixes Steffen Vogel
  2018-10-28 22:09 ` [PATCH 1/9] w1: add SPDX identifiers Steffen Vogel
@ 2018-10-28 22:09 ` Steffen Vogel
  2018-10-28 23:03   ` Joe Perches
  2018-10-28 22:09 ` [PATCH 3/9] w1: add newlines after declarations Steffen Vogel
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Steffen Vogel @ 2018-10-28 22:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Evgeniy Polyakov, Steffen Vogel

This satisfies a checkpatch warning

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
 drivers/w1/w1.c         | 56 +++++++++++++++++++++++++++++--------------------
 drivers/w1/w1_int.c     |  3 ++-
 drivers/w1/w1_io.c      | 29 +++++++++++++++----------
 drivers/w1/w1_netlink.c | 16 +++++++++-----
 4 files changed, 64 insertions(+), 40 deletions(-)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 2c64655b603c..bd95dfe4041d 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -85,7 +85,8 @@ static void w1_slave_release(struct device *dev)
 	sl->master->slave_count--;
 }
 
-static ssize_t name_show(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t name_show(struct device *dev,
+	struct device_attribute *attr, char *buf)
 {
 	struct w1_slave *sl = dev_to_w1_slave(dev);
 
@@ -203,9 +204,10 @@ struct device w1_slave_device = {
 	.driver = &w1_slave_driver,
 	.release = &w1_slave_release
 };
-#endif  /*  0  */
+#endif
 
-static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t w1_master_attribute_show_name(struct device *dev,
+	struct device_attribute *attr, char *buf)
 {
 	struct w1_master *md = dev_to_w1_master(dev);
 	ssize_t count;
@@ -217,9 +219,9 @@ static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_a
 	return count;
 }
 
-static ssize_t w1_master_attribute_store_search(struct device * dev,
+static ssize_t w1_master_attribute_store_search(struct device *dev,
 						struct device_attribute *attr,
-						const char * buf, size_t count)
+						const char *buf, size_t count)
 {
 	long tmp;
 	struct w1_master *md = dev_to_w1_master(dev);
@@ -286,7 +288,8 @@ static ssize_t w1_master_attribute_show_pullup(struct device *dev,
 	return count;
 }
 
-static ssize_t w1_master_attribute_show_pointer(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t w1_master_attribute_show_pointer(struct device *dev,
+	struct device_attribute *attr, char *buf)
 {
 	struct w1_master *md = dev_to_w1_master(dev);
 	ssize_t count;
@@ -297,7 +300,8 @@ static ssize_t w1_master_attribute_show_pointer(struct device *dev, struct devic
 	return count;
 }
 
-static ssize_t w1_master_attribute_show_timeout(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t w1_master_attribute_show_timeout(struct device *dev,
+	struct device_attribute *attr, char *buf)
 {
 	ssize_t count;
 	count = sprintf(buf, "%d\n", w1_timeout);
@@ -330,7 +334,8 @@ static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev,
 	return count;
 }
 
-static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev,
+	struct device_attribute *attr, char *buf)
 {
 	struct w1_master *md = dev_to_w1_master(dev);
 	ssize_t count;
@@ -338,10 +343,12 @@ static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, stru
 	mutex_lock(&md->mutex);
 	count = sprintf(buf, "%d\n", md->max_slave_count);
 	mutex_unlock(&md->mutex);
+
 	return count;
 }
 
-static ssize_t w1_master_attribute_show_attempts(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t w1_master_attribute_show_attempts(struct device *dev,
+	struct device_attribute *attr, char *buf)
 {
 	struct w1_master *md = dev_to_w1_master(dev);
 	ssize_t count;
@@ -349,10 +356,12 @@ static ssize_t w1_master_attribute_show_attempts(struct device *dev, struct devi
 	mutex_lock(&md->mutex);
 	count = sprintf(buf, "%lu\n", md->attempts);
 	mutex_unlock(&md->mutex);
+
 	return count;
 }
 
-static ssize_t w1_master_attribute_show_slave_count(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t w1_master_attribute_show_slave_count(struct device *dev,
+	struct device_attribute *attr, char *buf)
 {
 	struct w1_master *md = dev_to_w1_master(dev);
 	ssize_t count;
@@ -408,8 +417,7 @@ static int w1_atoreg_num(struct device *dev, const char *buf, size_t count,
 	 * print it either.  It would be unreasonable for the user to then
 	 * provide it.
 	 */
-	const char *error_msg = "bad slave string format, expecting "
-		"ff-dddddddddddd\n";
+	const char *error_msg = "bad slave string format, expecting ff-dddddddddddd\n";
 
 	if (buf[2] != '-') {
 		dev_err(dev, "%s", error_msg);
@@ -880,8 +888,8 @@ void w1_reconnect_slaves(struct w1_family *f, int attach)
 
 	mutex_lock(&w1_mlock);
 	list_for_each_entry(dev, &w1_masters, w1_master_entry) {
-		dev_dbg(&dev->dev, "Reconnecting slaves in device %s "
-			"for family %02x.\n", dev->name, f->fid);
+		dev_dbg(&dev->dev, "Reconnecting slaves in device %s for family %02x.\n",
+			dev->name, f->fid);
 		mutex_lock(&dev->mutex);
 		mutex_lock(&dev->list_mutex);
 		list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
@@ -905,8 +913,8 @@ void w1_reconnect_slaves(struct w1_family *f, int attach)
 				mutex_lock(&dev->list_mutex);
 			}
 		}
-		dev_dbg(&dev->dev, "Reconnecting slaves in device %s "
-			"has been finished.\n", dev->name);
+		dev_dbg(&dev->dev, "Reconnecting slaves in device %s has been finished.\n",
+			dev->name);
 		mutex_unlock(&dev->list_mutex);
 		mutex_unlock(&dev->mutex);
 	}
@@ -951,7 +959,8 @@ void w1_slave_found(struct w1_master *dev, u64 rn)
  * See "Application note 187 1-wire search algorithm" at www.maxim-ic.com
  *
  */
-void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb)
+void w1_search(struct w1_master *dev, u8 search_type,
+	w1_slave_found_callback cb)
 {
 	u64 last_rn, rn, tmp64;
 	int i, slave_count = 0;
@@ -1002,9 +1011,11 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
 		for (i = 0; i < 64; ++i) {
 			/* Determine the direction/search bit */
 			if (i == desc_bit)
-				search_bit = 1;	  /* took the 0 path last time, so take the 1 path */
+				/* took the 0 path last time, so take the 1 path */
+				search_bit = 1;
 			else if (i > desc_bit)
-				search_bit = 0;	  /* take the 0 path on the next branch */
+				/* take the 0 path on the next branch */
+				search_bit = 0;
 			else
 				search_bit = ((last_rn >> i) & 0x1);
 
@@ -1015,7 +1026,7 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
 			if ( (triplet_ret & 0x03) == 0x03 )
 				break;
 
-			/* If both directions were valid, and we took the 0 path... */
+			/* If both directions were valid, and we took the 0 path */
 			if (triplet_ret == 0)
 				last_zero = i;
 
@@ -1051,9 +1062,8 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
 			 * last id as the first id (provided it is still on the
 			 * bus).
 			 */
-			dev_info(&dev->dev, "%s: max_slave_count %d reached, "
-				"will continue next search.\n", __func__,
-				dev->max_slave_count);
+			dev_info(&dev->dev, "%s: max_slave_count %d reached, will continue next search.\n",
+				__func__, dev->max_slave_count);
 			set_bit(W1_WARN_MAX_COUNT, &dev->flags);
 		}
 	}
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index 507eea535d43..72b9392d9551 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -31,7 +31,8 @@ static struct w1_master *w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
 	/*
 	 * We are in process context(kernel thread), so can sleep.
 	 */
-	dev = kzalloc(sizeof(struct w1_master) + sizeof(struct w1_bus_master), GFP_KERNEL);
+	dev = kzalloc(sizeof(struct w1_master) +
+		sizeof(struct w1_bus_master), GFP_KERNEL);
 	if (!dev) {
 		pr_err("Failed to allocate %zd bytes for new w1 device.\n",
 			sizeof(struct w1_master));
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
index bc7d1f7a1222..2626a61852e9 100644
--- a/drivers/w1/w1_io.c
+++ b/drivers/w1/w1_io.c
@@ -73,7 +73,8 @@ static void w1_write_bit(struct w1_master *dev, int bit)
 {
 	unsigned long flags = 0;
 
-	if(w1_disable_irqs) local_irq_save(flags);
+	if (w1_disable_irqs)
+		local_irq_save(flags);
 
 	if (bit) {
 		dev->bus_master->write_bit(dev->bus_master->data, 0);
@@ -87,7 +88,8 @@ static void w1_write_bit(struct w1_master *dev, int bit)
 		w1_delay(10);
 	}
 
-	if(w1_disable_irqs) local_irq_restore(flags);
+	if (w1_disable_irqs)
+		local_irq_restore(flags);
 }
 
 /**
@@ -192,9 +194,10 @@ static u8 w1_read_bit(struct w1_master *dev)
  */
 u8 w1_triplet(struct w1_master *dev, int bdir)
 {
-	if (dev->bus_master->triplet)
-		return dev->bus_master->triplet(dev->bus_master->data, bdir);
-	else {
+	if (dev->bus_master->triplet) {
+		return dev->bus_master->triplet(dev->bus_master->data,
+			bdir);
+	} else {
 		u8 id_bit   = w1_touch_bit(dev, 1);
 		u8 comp_bit = w1_touch_bit(dev, 1);
 		u8 retval;
@@ -298,9 +301,10 @@ u8 w1_read_block(struct w1_master *dev, u8 *buf, int len)
 	int i;
 	u8 ret;
 
-	if (dev->bus_master->read_block)
-		ret = dev->bus_master->read_block(dev->bus_master->data, buf, len);
-	else {
+	if (dev->bus_master->read_block) {
+		ret = dev->bus_master->read_block(dev->bus_master->data,
+			buf, len);
+	} else {
 		for (i = 0; i < len; ++i)
 			buf[i] = w1_read_8(dev);
 		ret = len;
@@ -320,7 +324,8 @@ int w1_reset_bus(struct w1_master *dev)
 	int result;
 	unsigned long flags = 0;
 
-	if(w1_disable_irqs) local_irq_save(flags);
+	if (w1_disable_irqs)
+		local_irq_save(flags);
 
 	if (dev->bus_master->reset_bus)
 		result = dev->bus_master->reset_bus(dev->bus_master->data) & 0x1;
@@ -346,7 +351,8 @@ int w1_reset_bus(struct w1_master *dev)
 		msleep(1);
 	}
 
-	if(w1_disable_irqs) local_irq_restore(flags);
+	if (w1_disable_irqs)
+		local_irq_restore(flags);
 
 	return result;
 }
@@ -363,7 +369,8 @@ u8 w1_calc_crc8(u8 * data, int len)
 }
 EXPORT_SYMBOL_GPL(w1_calc_crc8);
 
-void w1_search_devices(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb)
+void w1_search_devices(struct w1_master *dev, u8 search_type,
+	w1_slave_found_callback cb)
 {
 	dev->attempts++;
 	if (dev->bus_master->search)
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c
index 0f2c6ed94b0f..54a82bf69566 100644
--- a/drivers/w1/w1_netlink.c
+++ b/drivers/w1/w1_netlink.c
@@ -82,8 +82,10 @@ static void w1_unref_block(struct w1_cb_block *block)
 static void w1_reply_make_space(struct w1_cb_block *block, u16 space)
 {
 	u16 len = w1_reply_len(block);
+
 	if (len + space >= block->maxlen) {
-		cn_netlink_send_mult(block->first_cn, len, block->portid, 0, GFP_KERNEL);
+		cn_netlink_send_mult(block->first_cn, len,
+			block->portid, 0, GFP_KERNEL);
 		block->first_cn->len = 0;
 		block->cn = NULL;
 		block->msg = NULL;
@@ -110,7 +112,8 @@ static void w1_netlink_check_send(struct w1_cb_block *block)
 static void w1_netlink_setup_msg(struct w1_cb_block *block, u32 ack)
 {
 	if (block->cn && block->cn->ack == ack) {
-		block->msg = (struct w1_netlink_msg *)(block->cn->data + block->cn->len);
+		block->msg = (struct w1_netlink_msg *)
+			(block->cn->data + block->cn->len);
 	} else {
 		/* advance or set to data */
 		if (block->cn)
@@ -170,7 +173,9 @@ static void w1_netlink_queue_status(struct w1_cb_block *block,
 	block->msg->len = 0;
 	block->msg->status = (u8)-error;
 	if (req_cmd) {
-		struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)block->msg->data;
+		struct w1_netlink_cmd *cmd =
+			(struct w1_netlink_cmd *) block->msg->data;
+
 		memcpy(cmd, req_cmd, sizeof(*cmd));
 		block->cn->len += sizeof(*cmd);
 		block->msg->len += sizeof(*cmd);
@@ -388,8 +393,9 @@ static int w1_process_command_slave(struct w1_slave *sl,
 		struct w1_netlink_cmd *cmd)
 {
 	dev_dbg(&sl->master->dev, "%s: %02x.%012llx.%02x: cmd=%02x, len=%u.\n",
-		__func__, sl->reg_num.family, (unsigned long long)sl->reg_num.id,
-		sl->reg_num.crc, cmd->cmd, cmd->len);
+		__func__, sl->reg_num.family,
+		(unsigned long long) sl->reg_num.id, sl->reg_num.crc, cmd->cmd,
+		cmd->len);
 
 	return w1_process_command_io(sl->master, cmd);
 }
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/9] w1: add newlines after declarations
  2018-10-28 22:09 w1: coding style and checkpatch fixes Steffen Vogel
  2018-10-28 22:09 ` [PATCH 1/9] w1: add SPDX identifiers Steffen Vogel
  2018-10-28 22:09 ` [PATCH 2/9] w1: improve coding style by following strict 80 column line limit Steffen Vogel
@ 2018-10-28 22:09 ` Steffen Vogel
  2018-10-28 22:09 ` [PATCH 4/9] w1: cleanup whitespaces according to coding style document Steffen Vogel
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Steffen Vogel @ 2018-10-28 22:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Evgeniy Polyakov, Steffen Vogel

This satisfies a checkpatch warning

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
 drivers/w1/w1.c         | 23 +++++++++++++++++++++++
 drivers/w1/w1_netlink.c |  7 +++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index bd95dfe4041d..812186ce35d6 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -130,6 +130,7 @@ static ssize_t rw_write(struct file *filp, struct kobject *kobj,
 
 out_up:
 	mutex_unlock(&sl->master->mutex);
+
 	return count;
 }
 
@@ -142,6 +143,7 @@ static ssize_t rw_read(struct file *filp, struct kobject *kobj,
 	mutex_lock(&sl->master->mutex);
 	w1_read_block(sl->master, buf, count);
 	mutex_unlock(&sl->master->mutex);
+
 	return count;
 }
 
@@ -297,6 +299,7 @@ static ssize_t w1_master_attribute_show_pointer(struct device *dev,
 	mutex_lock(&md->mutex);
 	count = sprintf(buf, "0x%p\n", md->bus_master);
 	mutex_unlock(&md->mutex);
+
 	return count;
 }
 
@@ -304,7 +307,9 @@ static ssize_t w1_master_attribute_show_timeout(struct device *dev,
 	struct device_attribute *attr, char *buf)
 {
 	ssize_t count;
+
 	count = sprintf(buf, "%d\n", w1_timeout);
+
 	return count;
 }
 
@@ -312,7 +317,9 @@ static ssize_t w1_master_attribute_show_timeout_us(struct device *dev,
 	struct device_attribute *attr, char *buf)
 {
 	ssize_t count;
+
 	count = sprintf(buf, "%d\n", w1_timeout_us);
+
 	return count;
 }
 
@@ -369,6 +376,7 @@ static ssize_t w1_master_attribute_show_slave_count(struct device *dev,
 	mutex_lock(&md->mutex);
 	count = sprintf(buf, "%d\n", md->slave_count);
 	mutex_unlock(&md->mutex);
+
 	return count;
 }
 
@@ -399,8 +407,10 @@ static ssize_t w1_master_attribute_show_add(struct device *dev,
 	struct device_attribute *attr, char *buf)
 {
 	int c = PAGE_SIZE;
+
 	c -= snprintf(buf+PAGE_SIZE - c, c,
 		"write device id xx-xxxxxxxxxxxx to add slave\n");
+
 	return PAGE_SIZE - c;
 }
 
@@ -449,6 +459,7 @@ struct w1_slave *w1_slave_search_device(struct w1_master *dev,
 	struct w1_reg_num *rn)
 {
 	struct w1_slave *sl;
+
 	mutex_lock(&dev->list_mutex);
 	list_for_each_entry(sl, &dev->slist, w1_slave_entry) {
 		if (sl->reg_num.family == rn->family &&
@@ -459,6 +470,7 @@ struct w1_slave *w1_slave_search_device(struct w1_master *dev,
 		}
 	}
 	mutex_unlock(&dev->list_mutex);
+
 	return NULL;
 }
 
@@ -495,8 +507,10 @@ static ssize_t w1_master_attribute_show_remove(struct device *dev,
 	struct device_attribute *attr, char *buf)
 {
 	int c = PAGE_SIZE;
+
 	c -= snprintf(buf+PAGE_SIZE - c, c,
 		"write device id xx-xxxxxxxxxxxx to remove slave\n");
+
 	return PAGE_SIZE - c;
 }
 
@@ -674,6 +688,7 @@ static int w1_family_notify(unsigned long action, struct w1_slave *sl)
 			sysfs_remove_groups(&sl->dev.kobj, fops->groups);
 		break;
 	}
+
 	return 0;
 }
 
@@ -709,6 +724,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
 			"Device registration [%s] failed. err=%d\n",
 			dev_name(&sl->dev), err);
 		put_device(&sl->dev);
+
 		return err;
 	}
 	w1_family_notify(BUS_NOTIFY_ADD_DEVICE, sl);
@@ -777,6 +793,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
 		w1_family_put(sl->family);
 		atomic_dec(&sl->master->refcnt);
 		kfree(sl);
+
 		return err;
 	}
 
@@ -793,6 +810,7 @@ int w1_unref_slave(struct w1_slave *sl)
 {
 	struct w1_master *dev = sl->master;
 	int refcnt;
+
 	mutex_lock(&dev->list_mutex);
 	refcnt = atomic_sub_return(1, &sl->refcnt);
 	if (refcnt == 0) {
@@ -817,6 +835,7 @@ int w1_unref_slave(struct w1_slave *sl)
 	}
 	atomic_dec(&dev->refcnt);
 	mutex_unlock(&dev->list_mutex);
+
 	return refcnt;
 }
 
@@ -824,6 +843,7 @@ int w1_slave_detach(struct w1_slave *sl)
 {
 	/* Only detach a slave once as it decreases the refcnt each time. */
 	int destroy_now;
+
 	mutex_lock(&sl->master->list_mutex);
 	destroy_now = !test_bit(W1_SLAVE_DETACH, &sl->flags);
 	set_bit(W1_SLAVE_DETACH, &sl->flags);
@@ -831,6 +851,7 @@ int w1_slave_detach(struct w1_slave *sl)
 
 	if (destroy_now)
 		destroy_now = !w1_unref_slave(sl);
+
 	return destroy_now ? 0 : -EBUSY;
 }
 
@@ -996,6 +1017,7 @@ void w1_search(struct w1_master *dev, u8 search_type,
 		/* Do fast search on single slave bus */
 		if (dev->max_slave_count == 1) {
 			int rv;
+
 			w1_write_8(dev, W1_READ_ROM);
 			rv = w1_read_block(dev, (u8 *)&rn, 8);
 			mutex_unlock(&dev->bus_mutex);
@@ -1127,6 +1149,7 @@ int w1_process_callbacks(struct w1_master *dev)
 			mutex_lock(&dev->list_mutex);
 		}
 	}
+
 	return ret;
 }
 
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c
index 54a82bf69566..ff858bf4a94d 100644
--- a/drivers/w1/w1_netlink.c
+++ b/drivers/w1/w1_netlink.c
@@ -63,6 +63,7 @@ static void w1_unref_block(struct w1_cb_block *block)
 {
 	if (atomic_sub_return(1, &block->refcnt) == 0) {
 		u16 len = w1_reply_len(block);
+
 		if (len) {
 			cn_netlink_send_mult(block->first_cn, len,
 				block->portid, 0, GFP_KERNEL);
@@ -137,6 +138,7 @@ static void w1_netlink_queue_cmd(struct w1_cb_block *block,
 	struct w1_netlink_cmd *cmd)
 {
 	u32 space;
+
 	w1_reply_make_space(block, sizeof(struct cn_msg) +
 		sizeof(struct w1_netlink_msg) + sizeof(*cmd) + cmd->len);
 
@@ -165,6 +167,7 @@ static void w1_netlink_queue_status(struct w1_cb_block *block,
 	int error)
 {
 	u16 space = sizeof(struct cn_msg) + sizeof(*req_msg) + sizeof(*req_cmd);
+
 	w1_reply_make_space(block, space);
 	w1_netlink_setup_msg(block, block->request_cn.ack);
 
@@ -276,6 +279,7 @@ static int w1_get_slaves(struct w1_master *dev, struct w1_netlink_cmd *req_cmd)
 
 	if (req_cmd->cmd == W1_CMD_LIST_SLAVES) {
 		u64 rn;
+
 		mutex_lock(&dev->list_mutex);
 		list_for_each_entry(sl, &dev->slist, w1_slave_entry) {
 			memcpy(&rn, &sl->reg_num, sizeof(rn));
@@ -508,6 +512,7 @@ static void w1_list_count_cmds(struct w1_netlink_msg *msg, int *cmd_count,
 	u16 mlen = msg->len;
 	u16 len;
 	int slave_list = 0;
+
 	while (mlen) {
 		if (cmd->len + sizeof(struct w1_netlink_cmd) > mlen)
 			break;
@@ -526,6 +531,7 @@ static void w1_list_count_cmds(struct w1_netlink_msg *msg, int *cmd_count,
 
 	if (slave_list) {
 		struct w1_master *dev = w1_search_master_id(msg->id.mst.id);
+
 		if (dev) {
 			/* Bytes, and likely an overstimate, and if it isn't
 			 * the results can still be split between packets.
@@ -586,6 +592,7 @@ static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp)
 	if (node_count) {
 		int size;
 		int reply_size = sizeof(*cn) + cn->len + slave_len;
+
 		if (cn->flags & W1_CN_BUNDLE) {
 			/* bundling duplicats some of the messages */
 			reply_size += 2 * cmd_count * (sizeof(struct cn_msg) +
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 4/9] w1: cleanup whitespaces according to coding style document
  2018-10-28 22:09 w1: coding style and checkpatch fixes Steffen Vogel
                   ` (2 preceding siblings ...)
  2018-10-28 22:09 ` [PATCH 3/9] w1: add newlines after declarations Steffen Vogel
@ 2018-10-28 22:09 ` Steffen Vogel
  2018-10-28 22:09 ` [PATCH 5/9] w1: use octal numbers instead of macros for file mode Steffen Vogel
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Steffen Vogel @ 2018-10-28 22:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Evgeniy Polyakov, Steffen Vogel

These changes fix several warnings emitted by the checkpatch tool.

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
 drivers/w1/w1.c         | 20 +++++++++-----------
 drivers/w1/w1_family.c  |  2 +-
 drivers/w1/w1_io.c      | 17 +++++++++--------
 drivers/w1/w1_netlink.c |  2 +-
 4 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 812186ce35d6..f64da16dbec9 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -775,7 +775,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
 	spin_lock(&w1_flock);
 	f = w1_family_registered(rn->family);
 	if (!f) {
-		f= &w1_default_family;
+		f = &w1_default_family;
 		dev_info(&dev->dev, "Family %x for %02x.%012llx.%02x is not registered.\n",
 			  rn->family, rn->family,
 			  (unsigned long long)rn->id, rn->crc);
@@ -997,7 +997,7 @@ void w1_search(struct w1_master *dev, u8 search_type,
 
 	desc_bit = 64;
 
-	while ( !last_device && (slave_count++ < dev->max_slave_count) ) {
+	while (!last_device && (slave_count++ < dev->max_slave_count)) {
 		last_rn = rn;
 		rn = 0;
 
@@ -1045,7 +1045,7 @@ void w1_search(struct w1_master *dev, u8 search_type,
 			triplet_ret = w1_triplet(dev, search_bit);
 
 			/* quit if no device responded */
-			if ( (triplet_ret & 0x03) == 0x03 )
+			if ((triplet_ret & 0x03) == 0x03)
 				break;
 
 			/* If both directions were valid, and we took the 0 path */
@@ -1064,13 +1064,12 @@ void w1_search(struct w1_master *dev, u8 search_type,
 		}
 		mutex_unlock(&dev->bus_mutex);
 
-		if ( (triplet_ret & 0x03) != 0x03 ) {
+		if ((triplet_ret & 0x03) != 0x03) {
 			if ((desc_bit == last_zero) || (last_zero < 0)) {
 				last_device = 1;
 				dev->search_id = 0;
-			} else {
+			} else
 				dev->search_id = rn;
-			}
 			desc_bit = last_zero;
 			cb(dev, rn);
 		}
@@ -1109,8 +1108,7 @@ void w1_search_process_cb(struct w1_master *dev, u8 search_type,
 			mutex_unlock(&dev->list_mutex);
 			w1_slave_detach(sl);
 			mutex_lock(&dev->list_mutex);
-		}
-		else if (test_bit(W1_SLAVE_ACTIVE, &sl->flags))
+		} else if (test_bit(W1_SLAVE_ACTIVE, &sl->flags))
 			sl->ttl = dev->slave_ttl;
 	}
 	mutex_unlock(&dev->list_mutex);
@@ -1142,7 +1140,8 @@ int w1_process_callbacks(struct w1_master *dev)
 		list_for_each_entry_safe(async_cmd, async_n, &dev->async_list,
 			async_entry) {
 			/* drop the lock, if it is a search it can take a long
-			 * time */
+			 * time
+			 */
 			mutex_unlock(&dev->list_mutex);
 			async_cmd->cb(dev, async_cmd);
 			ret = 1;
@@ -1199,8 +1198,7 @@ int w1_process(void *data)
 			if (!jremain)
 				jremain = jtime;
 			jremain = schedule_timeout(jremain);
-		}
-		else
+		} else
 			schedule();
 	}
 
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
index ee90a6733472..5abbeb86de6e 100644
--- a/drivers/w1/w1_family.c
+++ b/drivers/w1/w1_family.c
@@ -83,7 +83,7 @@ EXPORT_SYMBOL(w1_unregister_family);
 /*
  * Should be called under w1_flock held.
  */
-struct w1_family * w1_family_registered(u8 fid)
+struct w1_family *w1_family_registered(u8 fid)
 {
 	struct list_head *ent, *n;
 	struct w1_family *f = NULL;
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
index 2626a61852e9..283c89708c7c 100644
--- a/drivers/w1/w1_io.c
+++ b/drivers/w1/w1_io.c
@@ -140,13 +140,13 @@ void w1_write_8(struct w1_master *dev, u8 byte)
 	if (dev->bus_master->write_byte) {
 		w1_pre_write(dev);
 		dev->bus_master->write_byte(dev->bus_master->data, byte);
-	}
-	else
+	} else {
 		for (i = 0; i < 8; ++i) {
 			if (i == 7)
 				w1_pre_write(dev);
 			w1_touch_bit(dev, (byte >> i) & 0x1);
 		}
+	}
 	w1_post_write(dev);
 }
 EXPORT_SYMBOL_GPL(w1_write_8);
@@ -236,9 +236,10 @@ u8 w1_read_8(struct w1_master *dev)
 
 	if (dev->bus_master->read_byte)
 		res = dev->bus_master->read_byte(dev->bus_master->data);
-	else
+	else {
 		for (i = 0; i < 8; ++i)
-			res |= (w1_touch_bit(dev,1) << i);
+			res |= (w1_touch_bit(dev, 1) << i);
+	}
 
 	return res;
 }
@@ -257,10 +258,10 @@ void w1_write_block(struct w1_master *dev, const u8 *buf, int len)
 	if (dev->bus_master->write_block) {
 		w1_pre_write(dev);
 		dev->bus_master->write_block(dev->bus_master->data, buf, len);
-	}
-	else
+	} else {
 		for (i = 0; i < len; ++i)
 			w1_write_8(dev, buf[i]); /* calls w1_pre_write */
+	}
 	w1_post_write(dev);
 }
 EXPORT_SYMBOL_GPL(w1_write_block);
@@ -358,7 +359,7 @@ int w1_reset_bus(struct w1_master *dev)
 }
 EXPORT_SYMBOL_GPL(w1_reset_bus);
 
-u8 w1_calc_crc8(u8 * data, int len)
+u8 w1_calc_crc8(u8 *data, int len)
 {
 	u8 crc = 0;
 
@@ -400,7 +401,7 @@ int w1_reset_select_slave(struct w1_slave *sl)
 		w1_write_8(sl->master, W1_SKIP_ROM);
 	else {
 		u8 match[9] = {W1_MATCH_ROM, };
-		u64 rn = le64_to_cpu(*((u64*)&sl->reg_num));
+		u64 rn = le64_to_cpu(*((u64 *)&sl->reg_num));
 
 		memcpy(&match[1], &rn, 8);
 		w1_write_block(sl->master, match, 9);
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c
index ff858bf4a94d..b0c7abddd091 100644
--- a/drivers/w1/w1_netlink.c
+++ b/drivers/w1/w1_netlink.c
@@ -606,7 +606,7 @@ static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp)
 		 * space for replies which is the original message size plus
 		 * space for any list slave data and status messages
 		 * cn->len doesn't include itself which is part of the block
-		 * */
+		 */
 		size =  /* block + original message */
 			sizeof(struct w1_cb_block) + sizeof(*cn) + cn->len +
 			/* space for nodes */
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 5/9] w1: use octal numbers instead of macros for file mode
  2018-10-28 22:09 w1: coding style and checkpatch fixes Steffen Vogel
                   ` (3 preceding siblings ...)
  2018-10-28 22:09 ` [PATCH 4/9] w1: cleanup whitespaces according to coding style document Steffen Vogel
@ 2018-10-28 22:09 ` Steffen Vogel
  2018-10-29 13:46   ` Sebastian Reichel
  2018-10-28 22:09 ` [PATCH 6/9] w1: do not log errors about failed memory allocations Steffen Vogel
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Steffen Vogel @ 2018-10-28 22:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Evgeniy Polyakov, Steffen Vogel

This satifies a warning raised by the checkpatch tool.

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
 drivers/w1/w1.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index f64da16dbec9..bad2ee26cd4e 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -554,18 +554,18 @@ static ssize_t w1_master_attribute_store_remove(struct device *dev,
 		       w1_master_attribute_show_##_name,	\
 		       w1_master_attribute_store_##_name)
 
-static W1_MASTER_ATTR_RO(name, S_IRUGO);
-static W1_MASTER_ATTR_RO(slaves, S_IRUGO);
-static W1_MASTER_ATTR_RO(slave_count, S_IRUGO);
-static W1_MASTER_ATTR_RW(max_slave_count, S_IRUGO | S_IWUSR | S_IWGRP);
-static W1_MASTER_ATTR_RO(attempts, S_IRUGO);
-static W1_MASTER_ATTR_RO(timeout, S_IRUGO);
-static W1_MASTER_ATTR_RO(timeout_us, S_IRUGO);
-static W1_MASTER_ATTR_RO(pointer, S_IRUGO);
-static W1_MASTER_ATTR_RW(search, S_IRUGO | S_IWUSR | S_IWGRP);
-static W1_MASTER_ATTR_RW(pullup, S_IRUGO | S_IWUSR | S_IWGRP);
-static W1_MASTER_ATTR_RW(add, S_IRUGO | S_IWUSR | S_IWGRP);
-static W1_MASTER_ATTR_RW(remove, S_IRUGO | S_IWUSR | S_IWGRP);
+static W1_MASTER_ATTR_RO(name, 0444);
+static W1_MASTER_ATTR_RO(slaves, 0444);
+static W1_MASTER_ATTR_RO(slave_count, 0444);
+static W1_MASTER_ATTR_RW(max_slave_count, 0664);
+static W1_MASTER_ATTR_RO(attempts, 0444);
+static W1_MASTER_ATTR_RO(timeout, 0444);
+static W1_MASTER_ATTR_RO(timeout_us, 0444);
+static W1_MASTER_ATTR_RO(pointer, 0444);
+static W1_MASTER_ATTR_RW(search, 0664);
+static W1_MASTER_ATTR_RW(pullup, 0664);
+static W1_MASTER_ATTR_RW(add, 0664);
+static W1_MASTER_ATTR_RW(remove, 0664);
 
 static struct attribute *w1_master_default_attrs[] = {
 	&w1_master_attribute_name.attr,
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 6/9] w1: do not log errors about failed memory allocations
  2018-10-28 22:09 w1: coding style and checkpatch fixes Steffen Vogel
                   ` (4 preceding siblings ...)
  2018-10-28 22:09 ` [PATCH 5/9] w1: use octal numbers instead of macros for file mode Steffen Vogel
@ 2018-10-28 22:09 ` Steffen Vogel
  2018-10-28 22:09 ` [PATCH 7/9] w1: use __func__ for logging the function name Steffen Vogel
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Steffen Vogel @ 2018-10-28 22:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Evgeniy Polyakov, Steffen Vogel

This fixes a warning raised by the checkpatch tool.

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
 drivers/w1/w1.c     | 7 +------
 drivers/w1/w1_int.c | 6 +-----
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index bad2ee26cd4e..e8ce97e066ec 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -747,13 +747,8 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
 	struct w1_netlink_msg msg;
 
 	sl = kzalloc(sizeof(struct w1_slave), GFP_KERNEL);
-	if (!sl) {
-		dev_err(&dev->dev,
-			 "%s: failed to allocate new slave device.\n",
-			 __func__);
+	if (!sl)
 		return -ENOMEM;
-	}
-
 
 	sl->owner = THIS_MODULE;
 	sl->master = dev;
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index 72b9392d9551..dd34d6a33f50 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -33,12 +33,8 @@ static struct w1_master *w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
 	 */
 	dev = kzalloc(sizeof(struct w1_master) +
 		sizeof(struct w1_bus_master), GFP_KERNEL);
-	if (!dev) {
-		pr_err("Failed to allocate %zd bytes for new w1 device.\n",
-			sizeof(struct w1_master));
+	if (!dev)
 		return NULL;
-	}
-
 
 	dev->bus_master = (struct w1_bus_master *)(dev + 1);
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 7/9] w1: use __func__ for logging the function name
  2018-10-28 22:09 w1: coding style and checkpatch fixes Steffen Vogel
                   ` (5 preceding siblings ...)
  2018-10-28 22:09 ` [PATCH 6/9] w1: do not log errors about failed memory allocations Steffen Vogel
@ 2018-10-28 22:09 ` Steffen Vogel
  2018-10-28 22:09 ` [PATCH 8/9] w1: fix whitespaces of struct declarations Steffen Vogel
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Steffen Vogel @ 2018-10-28 22:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Evgeniy Polyakov, Steffen Vogel

This fixes a warning raised by the checkpatch tool.

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
 drivers/w1/w1.c     | 3 ++-
 drivers/w1/w1_int.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index e8ce97e066ec..c790c79352a0 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -1053,7 +1053,8 @@ void w1_search(struct w1_master *dev, u8 search_type,
 
 			if (test_bit(W1_ABORT_SEARCH, &dev->flags)) {
 				mutex_unlock(&dev->bus_mutex);
-				dev_dbg(&dev->dev, "Abort w1_search\n");
+				dev_dbg(&dev->dev, "Abort %s\n", __func__);
+
 				return;
 			}
 		}
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index dd34d6a33f50..694b61ca1f85 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -98,7 +98,7 @@ int w1_add_master_device(struct w1_bus_master *master)
 	if (!(master->touch_bit && master->reset_bus) &&
 	    !(master->write_bit && master->read_bit) &&
 	    !(master->write_byte && master->read_byte && master->reset_bus)) {
-		pr_err("w1_add_master_device: invalid function set\n");
+		pr_err("%s: invalid function set\n", __func__);
 		return(-EINVAL);
 	}
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 8/9] w1: fix whitespaces of struct declarations
  2018-10-28 22:09 w1: coding style and checkpatch fixes Steffen Vogel
                   ` (6 preceding siblings ...)
  2018-10-28 22:09 ` [PATCH 7/9] w1: use __func__ for logging the function name Steffen Vogel
@ 2018-10-28 22:09 ` Steffen Vogel
  2018-10-29  1:52   ` Joe Perches
  2018-10-28 22:09 ` [PATCH 9/9] w1: using linux instead of asm prefix for includes Steffen Vogel
  2018-10-28 22:53 ` w1: coding style and checkpatch fixes Linus Torvalds
  9 siblings, 1 reply; 18+ messages in thread
From: Steffen Vogel @ 2018-10-28 22:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Evgeniy Polyakov, Steffen Vogel

This fixes a warning raised by the checkpatch tool.

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
 drivers/w1/w1_netlink.h | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/drivers/w1/w1_netlink.h b/drivers/w1/w1_netlink.h
index 08cbf08f3649..7873eb54352e 100644
--- a/drivers/w1/w1_netlink.h
+++ b/drivers/w1/w1_netlink.h
@@ -61,19 +61,18 @@ enum w1_netlink_message_types {
  * The netlink connector data sequence is, struct nlmsghdr, struct cn_msg,
  * then one or more struct w1_netlink_msg (each with optional data).
  */
-struct w1_netlink_msg
-{
-	__u8				type;
-	__u8				status;
-	__u16				len;
+struct w1_netlink_msg {
+	__u8 type;
+	__u8 status;
+	__u16 len;
 	union {
-		__u8			id[8];
+		__u8 id[8];
 		struct w1_mst {
-			__u32		id;
-			__u32		res;
+			__u32 id;
+			__u32 res;
 		} mst;
 	} id;
-	__u8				data[0];
+	__u8 data[0];
 };
 
 /**
@@ -117,12 +116,11 @@ enum w1_commands {
  * One or more struct w1_netlink_cmd is placed starting at w1_netlink_msg.data
  * each with optional data.
  */
-struct w1_netlink_cmd
-{
-	__u8				cmd;
-	__u8				res;
-	__u16				len;
-	__u8				data[0];
+struct w1_netlink_cmd {
+	__u8 cmd;
+	__u8 res;
+	__u16 len;
+	__u8 data[0];
 };
 
 #ifdef __KERNEL__
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 9/9] w1: using linux instead of asm prefix for includes
  2018-10-28 22:09 w1: coding style and checkpatch fixes Steffen Vogel
                   ` (7 preceding siblings ...)
  2018-10-28 22:09 ` [PATCH 8/9] w1: fix whitespaces of struct declarations Steffen Vogel
@ 2018-10-28 22:09 ` Steffen Vogel
  2018-10-28 22:53 ` w1: coding style and checkpatch fixes Linus Torvalds
  9 siblings, 0 replies; 18+ messages in thread
From: Steffen Vogel @ 2018-10-28 22:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Evgeniy Polyakov, Steffen Vogel

This fixes a warning raised by the checkpatch tool

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
 drivers/w1/w1_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
index 283c89708c7c..b18d82cde71e 100644
--- a/drivers/w1/w1_io.c
+++ b/drivers/w1/w1_io.c
@@ -3,7 +3,7 @@
  * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
  */
 
-#include <asm/io.h>
+#include <linux/io.h>
 
 #include <linux/delay.h>
 #include <linux/moduleparam.h>
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: w1: coding style and checkpatch fixes
  2018-10-28 22:09 w1: coding style and checkpatch fixes Steffen Vogel
                   ` (8 preceding siblings ...)
  2018-10-28 22:09 ` [PATCH 9/9] w1: using linux instead of asm prefix for includes Steffen Vogel
@ 2018-10-28 22:53 ` Linus Torvalds
  2018-10-29  0:29   ` Steffen Vogel
  9 siblings, 1 reply; 18+ messages in thread
From: Linus Torvalds @ 2018-10-28 22:53 UTC (permalink / raw)
  To: post; +Cc: lkml, zbr

[ This is not about your patch series per se, only about your email settings ]

On Sun, Oct 28, 2018 at 3:20 PM Steffen Vogel <post@steffenvogel.de> wrote:
>
> This is my first series of patches for the Linux kernel.
> I started by familiarizing myself with coding style and
> satisfying my inner OCD by cleaning the 1-wire subsystem.

Sadly, your DKIM setup is wrong, causing all the emails to be marked
as spam when they go through a mailing list.

Your DKIM header looks like this:

  DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=steffenvogel.de;
          s=2017; t=1540764601;
h=from:from:sender:reply-to:subject:subject:date:date:
          message-id:message-id:to:to:cc:cc:mime-version:mime-version:
          content-type:content-transfer-encoding:content-transfer-encoding:
          in-reply-to:in-reply-to:references:references;

and the problem with that is the "sender" field in there.

A good mailing list will not change the contents of your email, or
most of the other headers, but it *will* set the sender field to the
mailing list.

End result: the DKIM signature is guaranteed to fail after the email
has gone through a mailing list.

In other words, putting the sender field as part of the DKIM-checked
headers is just wrong. It's a somewhat common mistake, but it's still
wrong. I wonder where people get their setups from, because I think
there is some DKIM guide on the internet that is actively spreading
this bad behavior.

You do have a few other oddities in there (the duplication of the
common fields), but they shouldn't matter.

                 Linus

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/9] w1: improve coding style by following strict 80 column line limit
  2018-10-28 22:09 ` [PATCH 2/9] w1: improve coding style by following strict 80 column line limit Steffen Vogel
@ 2018-10-28 23:03   ` Joe Perches
  0 siblings, 0 replies; 18+ messages in thread
From: Joe Perches @ 2018-10-28 23:03 UTC (permalink / raw)
  To: Steffen Vogel, linux-kernel; +Cc: Evgeniy Polyakov

On Sun, 2018-10-28 at 23:09 +0100, Steffen Vogel wrote:
> This satisfies a checkpatch warning

Perhaps run your patches through checkpatch with --strict

> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
[]
> @@ -85,7 +85,8 @@ static void w1_slave_release(struct device *dev)
>  	sl->master->slave_count--;
>  }
>  
> -static ssize_t name_show(struct device *dev, struct device_attribute *attr, char *buf)
> +static ssize_t name_show(struct device *dev,
> +	struct device_attribute *attr, char *buf)

atypical alignment.

> []

> @@ -170,7 +173,9 @@ static void w1_netlink_queue_status(struct w1_cb_block *block,
>  	block->msg->len = 0;
>  	block->msg->status = (u8)-error;
>  	if (req_cmd) {
> -		struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)block->msg->data;
> +		struct w1_netlink_cmd *cmd =
> +			(struct w1_netlink_cmd *) block->msg->data;

unnecessary space after cast



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: w1: coding style and checkpatch fixes
  2018-10-28 22:53 ` w1: coding style and checkpatch fixes Linus Torvalds
@ 2018-10-29  0:29   ` Steffen Vogel
  2018-10-29  1:31     ` Linus Torvalds
  0 siblings, 1 reply; 18+ messages in thread
From: Steffen Vogel @ 2018-10-29  0:29 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: lkml

Hi Linus,

Thanks! Its hopefully fixed now.

For those who are interested. Rspamd, by default, includes the sender
address into the list of signed headers:
https://www.rspamd.com/doc/modules/dkim_signing.html#default-sign_headers-after-173

> End result: the DKIM signature is guaranteed to fail after the email
> has gone through a mailing list.

There is RFC6377 which discusses this problem. On possible solution is
a mailing list service which understands DKIM and can check/sign the
messages.

See: https://tools.ietf.org/html/rfc6377

> You do have a few other oddities in there (the duplication of the
> common fields), but they shouldn't matter.

This is actually according to RFC. Listing signed header-fields
multiple times prohibits them from beeing modified and resigned my other
MTAs.

Thanks again,
Steffen

On Sun, Oct 28, 2018 at 03:53:07PM -0700, Linus Torvalds wrote:
> [ This is not about your patch series per se, only about your email settings ]
> 
> On Sun, Oct 28, 2018 at 3:20 PM Steffen Vogel <post@steffenvogel.de> wrote:
> >
> > This is my first series of patches for the Linux kernel.
> > I started by familiarizing myself with coding style and
> > satisfying my inner OCD by cleaning the 1-wire subsystem.
> 
> Sadly, your DKIM setup is wrong, causing all the emails to be marked
> as spam when they go through a mailing list.
> 
> Your DKIM header looks like this:
> 
>   DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=steffenvogel.de;
>           s=2017; t=1540764601;
> h=from:from:sender:reply-to:subject:subject:date:date:
>           message-id:message-id:to:to:cc:cc:mime-version:mime-version:
>           content-type:content-transfer-encoding:content-transfer-encoding:
>           in-reply-to:in-reply-to:references:references;
> 
> and the problem with that is the "sender" field in there.
> 
> A good mailing list will not change the contents of your email, or
> most of the other headers, but it *will* set the sender field to the
> mailing list.
> 
> 
> In other words, putting the sender field as part of the DKIM-checked
> headers is just wrong. It's a somewhat common mistake, but it's still
> wrong. I wonder where people get their setups from, because I think
> there is some DKIM guide on the internet that is actively spreading
> this bad behavior.
> 
> 
>                  Linus

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: w1: coding style and checkpatch fixes
  2018-10-29  0:29   ` Steffen Vogel
@ 2018-10-29  1:31     ` Linus Torvalds
  0 siblings, 0 replies; 18+ messages in thread
From: Linus Torvalds @ 2018-10-29  1:31 UTC (permalink / raw)
  To: post; +Cc: Linux Kernel Mailing List

On Sun, Oct 28, 2018 at 5:30 PM Steffen Vogel <post@steffenvogel.de> wrote:
>
> For those who are interested. Rspamd, by default, includes the sender
> address into the list of signed headers:

Ugh. That's just broken.

> There is RFC6377 which discusses this problem. On possible solution is
> a mailing list service which understands DKIM and can check/sign the
> messages.

I think that is almost purely historical.

People figured it out. The actual solution was that mailing lists just
don't rewrite headers or bodies, but they do set that "sender" line
(and add various new ones, like "List-ID" etc unsubscribe
information).

And that was exactly so that dkim would just work, without the list
having to then add its own signing that just causes even more
problems.

[ And no, lkml isn't actually great at this - it will mess up
whitespace on headers, so it only works with a relaxed/relaxed dkim
signature.

  But honestly, if you use strict/strict, you're doing something
wrong. It's a bad idea. Smtp was never whitespace-strict ]

> This is actually according to RFC. Listing signed header-fields
> multiple times prohibits them from beeing modified and resigned my other
> MTAs.

Again, that is mostly historical baggage. I don't think anybody
actually does that.

So yes, you'll find a lot of "what ifs" from ten years ago when people
weren't actually using dkim and mailing lists didn't try to work with
it. Mostly theoretical "this is how it could work".

I've seen some truly horrendous suggestions for mailing lists, like
always rewriting "From" headers etc exactly so that you can then make
a new dkim signature. That would make for a really bad mailing list.

.. and yes, I'm sure such bad mailing lists exist.

                Linus

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 8/9] w1: fix whitespaces of struct declarations
  2018-10-28 22:09 ` [PATCH 8/9] w1: fix whitespaces of struct declarations Steffen Vogel
@ 2018-10-29  1:52   ` Joe Perches
  2018-10-29  2:02     ` Steffen Vogel
  0 siblings, 1 reply; 18+ messages in thread
From: Joe Perches @ 2018-10-29  1:52 UTC (permalink / raw)
  To: Steffen Vogel, linux-kernel; +Cc: Evgeniy Polyakov

On Sun, 2018-10-28 at 23:09 +0100, Steffen Vogel wrote:
> This fixes a warning raised by the checkpatch tool.

checkpatch does not raise any whitespace errors on
this file.

It does suggest that braces could be moved.

$ ./scripts/checkpatch.pl -f --strict drivers/w1/w1_netlink.h
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#1: FILE: drivers/w1/w1_netlink.h:1:
+/*

ERROR: open brace '{' following struct go on the same line
#74: FILE: drivers/w1/w1_netlink.h:74:
+struct w1_netlink_msg
+{

ERROR: open brace '{' following struct go on the same line
#130: FILE: drivers/w1/w1_netlink.h:130:
+struct w1_netlink_cmd
+{

total: 2 errors, 1 warnings, 0 checks, 144 lines checked

> Signed-off-by: Steffen Vogel <post@steffenvogel.de>
> ---
>  drivers/w1/w1_netlink.h | 28 +++++++++++++---------------
>  1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/w1/w1_netlink.h b/drivers/w1/w1_netlink.h
> index 08cbf08f3649..7873eb54352e 100644
> --- a/drivers/w1/w1_netlink.h
> +++ b/drivers/w1/w1_netlink.h
> @@ -61,19 +61,18 @@ enum w1_netlink_message_types {
>   * The netlink connector data sequence is, struct nlmsghdr, struct cn_msg,
>   * then one or more struct w1_netlink_msg (each with optional data).
>   */
> -struct w1_netlink_msg does n
> -{
> -	__u8				type;
> -	__u8				status;
> -	__u16				len;
> +struct w1_netlink_msg {
> +	__u8 type;
> +	__u8 status;
> +	__u16 len;
>  	union {
> -		__u8			id[8];
> +		__u8 id[8];
>  		struct w1_mst {
> -			__u32		id;
> -			__u32		res;
> +			__u32 id;
> +			__u32 res;
>  		} mst;
>  	} id;
> -	__u8				data[0];
> +	__u8 data[0];
>  };
>  
>  /**
> @@ -117,12 +116,11 @@ enum w1_commands {
>   * One or more struct w1_netlink_cmd is placed starting at w1_netlink_msg.data
>   * each with optional data.
>   */
> -struct w1_netlink_cmd
> -{
> -	__u8				cmd;
> -	__u8				res;
> -	__u16				len;
> -	__u8				data[0];
> +struct w1_netlink_cmd {
> +	__u8 cmd;
> +	__u8 res;
> +	__u16 len;
> +	__u8 data[0];
>  };
>  
>  #ifdef __KERNEL__


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 8/9] w1: fix whitespaces of struct declarations
  2018-10-29  1:52   ` Joe Perches
@ 2018-10-29  2:02     ` Steffen Vogel
  2018-10-29  2:04       ` Joe Perches
  0 siblings, 1 reply; 18+ messages in thread
From: Steffen Vogel @ 2018-10-29  2:02 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel, Evgeniy Polyakov

Hi Joe,

v2 of this patch set is almost ready.
I reran checkpatch.pl with '--strict'. So more warnings will be fixed by
the second version.

See my comments below.

On Sun, Oct 28, 2018 at 06:52:23PM -0700, Joe Perches wrote:
> On Sun, 2018-10-28 at 23:09 +0100, Steffen Vogel wrote:
> > This fixes a warning raised by the checkpatch tool.
> 
> checkpatch does not raise any whitespace errors on
> this file.
> 
> It does suggest that braces could be moved.

Ah okay, I considered moving a brace also a whitespace change.
Do you prefer the original indention of the struct members?
I dont see it very often in kernel code.

Cheers,
Steffen

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 8/9] w1: fix whitespaces of struct declarations
  2018-10-29  2:02     ` Steffen Vogel
@ 2018-10-29  2:04       ` Joe Perches
  0 siblings, 0 replies; 18+ messages in thread
From: Joe Perches @ 2018-10-29  2:04 UTC (permalink / raw)
  To: Steffen Vogel; +Cc: linux-kernel, Evgeniy Polyakov

On Mon, 2018-10-29 at 03:02 +0100, Steffen Vogel wrote:
> Hi Joe,
> 
> v2 of this patch set is almost ready.
> I reran checkpatch.pl with '--strict'. So more warnings will be fixed by
> the second version.
> 
> See my comments below.
> 
> On Sun, Oct 28, 2018 at 06:52:23PM -0700, Joe Perches wrote:
> > On Sun, 2018-10-28 at 23:09 +0100, Steffen Vogel wrote:
> > > This fixes a warning raised by the checkpatch tool.
> > 
> > checkpatch does not raise any whitespace errors on
> > this file.
> > 
> > It does suggest that braces could be moved.
> 
> Ah okay, I considered moving a brace also a whitespace change.
> Do you prefer the original indention of the struct members?
> I dont see it very often in kernel code.

The indentation doesn't matter to me.

The commit message description of a checkpatch warning
that does not exist is incorrect.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/9] w1: use octal numbers instead of macros for file mode
  2018-10-28 22:09 ` [PATCH 5/9] w1: use octal numbers instead of macros for file mode Steffen Vogel
@ 2018-10-29 13:46   ` Sebastian Reichel
  0 siblings, 0 replies; 18+ messages in thread
From: Sebastian Reichel @ 2018-10-29 13:46 UTC (permalink / raw)
  To: Steffen Vogel; +Cc: linux-kernel, Evgeniy Polyakov

[-- Attachment #1: Type: text/plain, Size: 2014 bytes --]

Hi,

On Sun, Oct 28, 2018 at 11:09:24PM +0100, Steffen Vogel wrote:
> This satifies a warning raised by the checkpatch tool.
> 
> Signed-off-by: Steffen Vogel <post@steffenvogel.de>
> ---
>  drivers/w1/w1.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index f64da16dbec9..bad2ee26cd4e 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -554,18 +554,18 @@ static ssize_t w1_master_attribute_store_remove(struct device *dev,
>  		       w1_master_attribute_show_##_name,	\
>  		       w1_master_attribute_store_##_name)
>  
> -static W1_MASTER_ATTR_RO(name, S_IRUGO);
> -static W1_MASTER_ATTR_RO(slaves, S_IRUGO);
> -static W1_MASTER_ATTR_RO(slave_count, S_IRUGO);
> -static W1_MASTER_ATTR_RW(max_slave_count, S_IRUGO | S_IWUSR | S_IWGRP);
> -static W1_MASTER_ATTR_RO(attempts, S_IRUGO);
> -static W1_MASTER_ATTR_RO(timeout, S_IRUGO);
> -static W1_MASTER_ATTR_RO(timeout_us, S_IRUGO);
> -static W1_MASTER_ATTR_RO(pointer, S_IRUGO);
> -static W1_MASTER_ATTR_RW(search, S_IRUGO | S_IWUSR | S_IWGRP);
> -static W1_MASTER_ATTR_RW(pullup, S_IRUGO | S_IWUSR | S_IWGRP);
> -static W1_MASTER_ATTR_RW(add, S_IRUGO | S_IWUSR | S_IWGRP);
> -static W1_MASTER_ATTR_RW(remove, S_IRUGO | S_IWUSR | S_IWGRP);
> +static W1_MASTER_ATTR_RO(name, 0444);
> +static W1_MASTER_ATTR_RO(slaves, 0444);
> +static W1_MASTER_ATTR_RO(slave_count, 0444);
> +static W1_MASTER_ATTR_RW(max_slave_count, 0664);
> +static W1_MASTER_ATTR_RO(attempts, 0444);
> +static W1_MASTER_ATTR_RO(timeout, 0444);
> +static W1_MASTER_ATTR_RO(timeout_us, 0444);
> +static W1_MASTER_ATTR_RO(pointer, 0444);
> +static W1_MASTER_ATTR_RW(search, 0664);
> +static W1_MASTER_ATTR_RW(pullup, 0664);
> +static W1_MASTER_ATTR_RW(add, 0664);
> +static W1_MASTER_ATTR_RW(remove, 0664);

Since the permissions are the same for all instances, the macros
could be simplified further (e.g. W1_MASTER_ATTR_RW(remove)).

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2018-10-29 13:46 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-28 22:09 w1: coding style and checkpatch fixes Steffen Vogel
2018-10-28 22:09 ` [PATCH 1/9] w1: add SPDX identifiers Steffen Vogel
2018-10-28 22:09 ` [PATCH 2/9] w1: improve coding style by following strict 80 column line limit Steffen Vogel
2018-10-28 23:03   ` Joe Perches
2018-10-28 22:09 ` [PATCH 3/9] w1: add newlines after declarations Steffen Vogel
2018-10-28 22:09 ` [PATCH 4/9] w1: cleanup whitespaces according to coding style document Steffen Vogel
2018-10-28 22:09 ` [PATCH 5/9] w1: use octal numbers instead of macros for file mode Steffen Vogel
2018-10-29 13:46   ` Sebastian Reichel
2018-10-28 22:09 ` [PATCH 6/9] w1: do not log errors about failed memory allocations Steffen Vogel
2018-10-28 22:09 ` [PATCH 7/9] w1: use __func__ for logging the function name Steffen Vogel
2018-10-28 22:09 ` [PATCH 8/9] w1: fix whitespaces of struct declarations Steffen Vogel
2018-10-29  1:52   ` Joe Perches
2018-10-29  2:02     ` Steffen Vogel
2018-10-29  2:04       ` Joe Perches
2018-10-28 22:09 ` [PATCH 9/9] w1: using linux instead of asm prefix for includes Steffen Vogel
2018-10-28 22:53 ` w1: coding style and checkpatch fixes Linus Torvalds
2018-10-29  0:29   ` Steffen Vogel
2018-10-29  1:31     ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).