* [PATCH v2 00/11] w1: coding style and checkpatch fixes
@ 2018-10-29 3:03 Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 01/12] w1: add SPDX identifiers Steffen Vogel
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, Steffen Vogel
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.
Cheers,
Steffen
---
Changes since v1:
- addressed comments from Joe Perches:
- re-ran checkpatch.pl in --strict mode
- fixed commit messages to reflect more precisly
the checkpatch warnings
Steffen Vogel (12):
w1: add SPDX identifiers
w1: improve code-style by adhering tp 80 columns per line limit
w1: add newlines after declarations
w1: cleanup whitespaces according to coding style document
w1: use octal numbers instead of macros for file mode
w1: do not log errors about failed memory allocations
w1: use __func__ for logging the function name
w1: improve code-style of struct declarations
w1: using linux instead of asm prefix for includes
w1: use pointers instead of types to determine size of allocs
w1: replace non-standard %LX format-string by %llX
w1: fix typo in comment
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 | 272 +++++++++++++++++++++++------------------
drivers/w1/w1_family.c | 15 +--
drivers/w1/w1_int.c | 34 ++----
drivers/w1/w1_internal.h | 11 +-
drivers/w1/w1_io.c | 86 ++++++-------
drivers/w1/w1_netlink.c | 64 +++++-----
drivers/w1/w1_netlink.h | 39 +++---
29 files changed, 283 insertions(+), 411 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 01/12] w1: add SPDX identifiers
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 02/12] w1: improve code-style by adhering tp 80 columns per line limit Steffen Vogel
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, 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] 13+ messages in thread
* [PATCH v2 02/12] w1: improve code-style by adhering tp 80 columns per line limit
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 01/12] w1: add SPDX identifiers Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 03/12] w1: add newlines after declarations Steffen Vogel
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, Steffen Vogel
Furthermore indentation of broken lines has been fixed.
This fixes several warnings raised by the checkpatch.pl script.
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
drivers/w1/w1.c | 160 +++++++++++++++++++++++++++---------------------
drivers/w1/w1_family.c | 2 +-
drivers/w1/w1_int.c | 15 ++---
drivers/w1/w1_io.c | 33 ++++++----
drivers/w1/w1_netlink.c | 42 ++++++++-----
5 files changed, 145 insertions(+), 107 deletions(-)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 2c64655b603c..6b3cdc5a09fb 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -45,13 +45,11 @@ MODULE_PARM_DESC(timeout_us,
*/
int w1_max_slave_count = 64;
module_param_named(max_slave_count, w1_max_slave_count, int, 0);
-MODULE_PARM_DESC(max_slave_count,
- "maximum number of slaves detected in a search");
+MODULE_PARM_DESC(max_slave_count, "maximum number of slaves detected in a search");
int w1_max_slave_ttl = 10;
module_param_named(slave_ttl, w1_max_slave_ttl, int, 0);
-MODULE_PARM_DESC(slave_ttl,
- "Number of searches not seeing a slave before it will be removed");
+MODULE_PARM_DESC(slave_ttl, "Number of searches not seeing a slave before it will be removed");
DEFINE_MUTEX(w1_mlock);
LIST_HEAD(w1_masters);
@@ -85,7 +83,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);
@@ -94,7 +93,7 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr, char
static DEVICE_ATTR_RO(name);
static ssize_t id_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr, char *buf)
{
struct w1_slave *sl = dev_to_w1_slave(dev);
ssize_t count = sizeof(sl->reg_num);
@@ -203,9 +202,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 +217,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 +286,9 @@ 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 +299,9 @@ 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);
@@ -305,7 +309,8 @@ static ssize_t w1_master_attribute_show_timeout(struct device *dev, struct devic
}
static ssize_t w1_master_attribute_show_timeout_us(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr,
+ char *buf)
{
ssize_t count;
count = sprintf(buf, "%d\n", w1_timeout_us);
@@ -313,7 +318,9 @@ static ssize_t w1_master_attribute_show_timeout_us(struct device *dev,
}
static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev,
- struct device_attribute *attr, const char *buf, size_t count)
+ struct device_attribute *attr,
+ const char *buf,
+ size_t count)
{
int tmp;
struct w1_master *md = dev_to_w1_master(dev);
@@ -330,7 +337,9 @@ 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 +347,13 @@ 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 +361,13 @@ 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;
@@ -364,7 +379,8 @@ static ssize_t w1_master_attribute_show_slave_count(struct device *dev, struct d
}
static ssize_t w1_master_attribute_show_slaves(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr,
+ char *buf)
{
struct w1_master *md = dev_to_w1_master(dev);
int c = PAGE_SIZE;
@@ -387,7 +403,8 @@ static ssize_t w1_master_attribute_show_slaves(struct device *dev,
}
static ssize_t w1_master_attribute_show_add(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr,
+ char *buf)
{
int c = PAGE_SIZE;
c -= snprintf(buf+PAGE_SIZE - c, c,
@@ -396,7 +413,7 @@ static ssize_t w1_master_attribute_show_add(struct device *dev,
}
static int w1_atoreg_num(struct device *dev, const char *buf, size_t count,
- struct w1_reg_num *rn)
+ struct w1_reg_num *rn)
{
unsigned int family;
unsigned long long id;
@@ -408,8 +425,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);
@@ -428,7 +444,7 @@ static int w1_atoreg_num(struct device *dev, const char *buf, size_t count,
#if 0
dev_info(dev, "With CRC device is %02x.%012llx.%02x.\n",
- rn->family, (unsigned long long)rn->id, rn->crc);
+ rn->family, (unsigned long long)rn->id, rn->crc);
#endif
return 0;
@@ -438,14 +454,14 @@ static int w1_atoreg_num(struct device *dev, const char *buf, size_t count,
* Note: must not hold list_mutex
*/
struct w1_slave *w1_slave_search_device(struct w1_master *dev,
- struct w1_reg_num *rn)
+ 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 &&
- sl->reg_num.id == rn->id &&
- sl->reg_num.crc == rn->crc) {
+ sl->reg_num.id == rn->id &&
+ sl->reg_num.crc == rn->crc) {
mutex_unlock(&dev->list_mutex);
return sl;
}
@@ -455,8 +471,8 @@ struct w1_slave *w1_slave_search_device(struct w1_master *dev,
}
static ssize_t w1_master_attribute_store_add(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct w1_master *md = dev_to_w1_master(dev);
struct w1_reg_num rn;
@@ -484,7 +500,8 @@ static ssize_t w1_master_attribute_store_add(struct device *dev,
}
static ssize_t w1_master_attribute_show_remove(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr,
+ char *buf)
{
int c = PAGE_SIZE;
c -= snprintf(buf+PAGE_SIZE - c, c,
@@ -513,7 +530,7 @@ static ssize_t w1_master_attribute_store_remove(struct device *dev,
result = count;
} else {
dev_info(dev, "Device %02x-%012llx doesn't exists\n", rn.family,
- (unsigned long long)rn.id);
+ (unsigned long long)rn.id);
result = -EINVAL;
}
mutex_unlock(&md->mutex);
@@ -596,7 +613,7 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
}
dev_dbg(dev, "Hotplug event for %s %s, bus_id=%s.\n",
- event_owner, name, dev_name(dev));
+ event_owner, name, dev_name(dev));
if (dev->driver != &w1_slave_driver || !sl)
goto end;
@@ -643,11 +660,13 @@ static int w1_family_notify(unsigned long action, struct w1_slave *sl)
}
}
if (IS_REACHABLE(CONFIG_HWMON) && fops->chip_info) {
- struct device *hwmon
- = hwmon_device_register_with_info(&sl->dev,
- "w1_slave_temp", sl,
- fops->chip_info,
- NULL);
+ struct device *hwmon =
+ hwmon_device_register_with_info(&sl->dev,
+ "w1_slave_temp",
+ sl,
+ fops->chip_info,
+ NULL);
+
if (IS_ERR(hwmon)) {
dev_warn(&sl->dev,
"could not create hwmon device\n");
@@ -657,8 +676,7 @@ static int w1_family_notify(unsigned long action, struct w1_slave *sl)
}
break;
case BUS_NOTIFY_DEL_DEVICE:
- if (IS_REACHABLE(CONFIG_HWMON) && fops->chip_info &&
- sl->hwmon)
+ if (IS_REACHABLE(CONFIG_HWMON) && fops->chip_info && sl->hwmon)
hwmon_device_unregister(sl->hwmon);
if (fops->remove_slave)
sl->family->fops->remove_slave(sl);
@@ -682,12 +700,12 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
sl->family->of_match_table);
dev_set_name(&sl->dev, "%02x-%012llx",
- (unsigned int) sl->reg_num.family,
- (unsigned long long) sl->reg_num.id);
+ (unsigned int)sl->reg_num.family,
+ (unsigned long long)sl->reg_num.id);
snprintf(&sl->name[0], sizeof(sl->name),
"%02x-%012llx",
- (unsigned int) sl->reg_num.family,
- (unsigned long long) sl->reg_num.id);
+ (unsigned int)sl->reg_num.family,
+ (unsigned long long)sl->reg_num.id);
dev_dbg(&sl->dev, "%s: registering %s as %p.\n", __func__,
dev_name(&sl->dev), sl);
@@ -741,7 +759,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
atomic_inc(&sl->master->refcnt);
dev->slave_count++;
dev_info(&dev->dev, "Attaching one wire slave %02x.%012llx crc %02x\n",
- rn->family, (unsigned long long)rn->id, rn->crc);
+ rn->family, (unsigned long long)rn->id, rn->crc);
/* slave modules need to be loaded in a context with unlocked mutex */
mutex_unlock(&dev->mutex);
@@ -753,8 +771,8 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
if (!f) {
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);
+ rn->family, rn->family,
+ (unsigned long long)rn->id, rn->crc);
}
__w1_family_get(f);
spin_unlock(&w1_flock);
@@ -764,7 +782,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
err = __w1_attach_slave_device(sl);
if (err < 0) {
dev_err(&dev->dev, "%s: Attaching %s failed.\n", __func__,
- sl->name);
+ sl->name);
dev->slave_count--;
w1_family_put(sl->family);
atomic_dec(&sl->master->refcnt);
@@ -855,8 +873,8 @@ struct w1_slave *w1_search_slave(struct w1_reg_num *id)
mutex_lock(&dev->list_mutex);
list_for_each_entry(sl, &dev->slist, w1_slave_entry) {
if (sl->reg_num.family == id->family &&
- sl->reg_num.id == id->id &&
- sl->reg_num.crc == id->crc) {
+ sl->reg_num.id == id->id &&
+ sl->reg_num.crc == id->crc) {
found = 1;
atomic_inc(&dev->refcnt);
atomic_inc(&sl->refcnt);
@@ -880,8 +898,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) {
@@ -890,9 +908,9 @@ void w1_reconnect_slaves(struct w1_family *f, int attach)
* connected. If the family is going away, devices
* matching that family are reconneced.
*/
- if ((attach && sl->family->fid == W1_FAMILY_DEFAULT
- && sl->reg_num.family == f->fid) ||
- (!attach && sl->family->fid == f->fid)) {
+ if ((attach && sl->family->fid == W1_FAMILY_DEFAULT &&
+ sl->reg_num.family == f->fid) ||
+ (!attach && sl->family->fid == f->fid)) {
struct w1_reg_num rn;
mutex_unlock(&dev->list_mutex);
@@ -905,8 +923,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 +969,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 +1021,15 @@ 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 +1040,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;
@@ -1043,7 +1068,7 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
}
if (!last_device && slave_count == dev->max_slave_count &&
- !test_bit(W1_WARN_MAX_COUNT, &dev->flags)) {
+ !test_bit(W1_WARN_MAX_COUNT, &dev->flags)) {
/* Only max_slave_count will be scanned in a search,
* but it will start where it left off next search
* until all ids are identified and then it will start
@@ -1051,16 +1076,15 @@ 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);
}
}
}
void w1_search_process_cb(struct w1_master *dev, u8 search_type,
- w1_slave_found_callback cb)
+ w1_slave_found_callback cb)
{
struct w1_slave *sl, *sln;
@@ -1108,7 +1132,7 @@ int w1_process_callbacks(struct w1_master *dev)
/* The list can be added to in another thread, loop until it is empty */
while (!list_empty(&dev->async_list)) {
list_for_each_entry_safe(async_cmd, async_n, &dev->async_list,
- async_entry) {
+ async_entry) {
/* drop the lock, if it is a search it can take a long
* time */
mutex_unlock(&dev->list_mutex);
@@ -1192,15 +1216,13 @@ static int __init w1_init(void)
retval = driver_register(&w1_master_driver);
if (retval) {
- pr_err("Failed to register master driver. err=%d.\n",
- retval);
+ pr_err("Failed to register master driver. err=%d.\n", retval);
goto err_out_bus_unregister;
}
retval = driver_register(&w1_slave_driver);
if (retval) {
- pr_err("Failed to register slave driver. err=%d.\n",
- retval);
+ pr_err("Failed to register slave driver. err=%d.\n", retval);
goto err_out_master_unregister;
}
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
index ee90a6733472..f351defbef23 100644
--- a/drivers/w1/w1_family.c
+++ b/drivers/w1/w1_family.c
@@ -72,7 +72,7 @@ void w1_unregister_family(struct w1_family *fent)
while (atomic_read(&fent->refcnt)) {
pr_info("Waiting for family %u to become free: refcnt=%d.\n",
- fent->fid, atomic_read(&fent->refcnt));
+ fent->fid, atomic_read(&fent->refcnt));
if (msleep_interruptible(1000))
flush_signals(current);
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index 507eea535d43..efe03b9e23f5 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -22,8 +22,8 @@ static int w1_enable_pullup = 1;
module_param_named(enable_pullup, w1_enable_pullup, int, 0);
static struct w1_master *w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
- struct device_driver *driver,
- struct device *device)
+ struct device_driver *driver,
+ struct device *device)
{
struct w1_master *dev;
int err;
@@ -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));
@@ -121,7 +122,7 @@ int w1_add_master_device(struct w1_bus_master *master)
} while (found);
dev = w1_alloc_dev(id, w1_max_slave_count, w1_max_slave_ttl,
- &w1_master_driver, &w1_master_device);
+ &w1_master_driver, &w1_master_device);
if (!dev) {
mutex_unlock(&w1_mlock);
return -ENOMEM;
@@ -141,8 +142,8 @@ int w1_add_master_device(struct w1_bus_master *master)
if (IS_ERR(dev->thread)) {
retval = PTR_ERR(dev->thread);
dev_err(&dev->dev,
- "Failed to create new kernel thread. err=%d\n",
- retval);
+ "Failed to create new kernel thread. err=%d\n",
+ retval);
mutex_unlock(&w1_mlock);
goto err_out_rm_attr;
}
@@ -197,7 +198,7 @@ void __w1_remove_master_device(struct w1_master *dev)
while (atomic_read(&dev->refcnt)) {
dev_info(&dev->dev, "Waiting for %s to become free: refcnt=%d.\n",
- dev->name, atomic_read(&dev->refcnt));
+ dev->name, atomic_read(&dev->refcnt));
if (msleep_interruptible(1000))
flush_signals(current);
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
index bc7d1f7a1222..caf07bda18d1 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);
}
/**
@@ -101,9 +103,9 @@ static void w1_write_bit(struct w1_master *dev, int bit)
static void w1_pre_write(struct w1_master *dev)
{
if (dev->pullup_duration &&
- dev->enable_pullup && dev->bus_master->set_pullup) {
+ dev->enable_pullup && dev->bus_master->set_pullup) {
dev->bus_master->set_pullup(dev->bus_master->data,
- dev->pullup_duration);
+ dev->pullup_duration);
}
}
@@ -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..7ef46d8ab059 100644
--- a/drivers/w1/w1_netlink.c
+++ b/drivers/w1/w1_netlink.c
@@ -65,7 +65,7 @@ static void w1_unref_block(struct w1_cb_block *block)
u16 len = w1_reply_len(block);
if (len) {
cn_netlink_send_mult(block->first_cn, len,
- block->portid, 0, GFP_KERNEL);
+ block->portid, 0, GFP_KERNEL);
}
kfree(block);
}
@@ -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)
@@ -131,7 +134,7 @@ static void w1_netlink_setup_msg(struct w1_cb_block *block, u32 ack)
* the results.
*/
static void w1_netlink_queue_cmd(struct w1_cb_block *block,
- struct w1_netlink_cmd *cmd)
+ struct w1_netlink_cmd *cmd)
{
u32 space;
w1_reply_make_space(block, sizeof(struct cn_msg) +
@@ -158,8 +161,9 @@ static void w1_netlink_queue_cmd(struct w1_cb_block *block,
* copied.
*/
static void w1_netlink_queue_status(struct w1_cb_block *block,
- struct w1_netlink_msg *req_msg, struct w1_netlink_cmd *req_cmd,
- int error)
+ struct w1_netlink_msg *req_msg,
+ struct w1_netlink_cmd *req_cmd,
+ int error)
{
u16 space = sizeof(struct cn_msg) + sizeof(*req_msg) + sizeof(*req_cmd);
w1_reply_make_space(block, space);
@@ -170,7 +174,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);
@@ -189,8 +195,9 @@ static void w1_netlink_queue_status(struct w1_cb_block *block,
* Use when a block isn't available to queue the message to and cn, msg
* might not be contiguous.
*/
-static void w1_netlink_send_error(struct cn_msg *cn, struct w1_netlink_msg *msg,
- int portid, int error)
+static void w1_netlink_send_error(struct cn_msg *cn,
+ struct w1_netlink_msg *msg,
+ int portid, int error)
{
struct {
struct cn_msg cn;
@@ -286,7 +293,7 @@ static int w1_get_slaves(struct w1_master *dev, struct w1_netlink_cmd *req_cmd)
}
static int w1_process_command_io(struct w1_master *dev,
- struct w1_netlink_cmd *cmd)
+ struct w1_netlink_cmd *cmd)
{
int err = 0;
@@ -311,7 +318,7 @@ static int w1_process_command_io(struct w1_master *dev,
}
static int w1_process_command_addremove(struct w1_master *dev,
- struct w1_netlink_cmd *cmd)
+ struct w1_netlink_cmd *cmd)
{
struct w1_slave *sl;
int err = 0;
@@ -345,7 +352,7 @@ static int w1_process_command_addremove(struct w1_master *dev,
}
static int w1_process_command_master(struct w1_master *dev,
- struct w1_netlink_cmd *req_cmd)
+ struct w1_netlink_cmd *req_cmd)
{
int err = -EINVAL;
@@ -385,11 +392,12 @@ static int w1_process_command_master(struct w1_master *dev,
}
static int w1_process_command_slave(struct w1_slave *sl,
- struct w1_netlink_cmd *cmd)
+ 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);
}
@@ -496,7 +504,7 @@ static void w1_process_cb(struct w1_master *dev, struct w1_async_cmd *async_cmd)
}
static void w1_list_count_cmds(struct w1_netlink_msg *msg, int *cmd_count,
- u16 *slave_len)
+ u16 *slave_len)
{
struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)msg->data;
u16 mlen = msg->len;
@@ -662,7 +670,7 @@ static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp)
dev = sl->master;
} else {
pr_notice("%s: cn: %x.%x, wrong type: %u, len: %u.\n",
- __func__, cn->id.idx, cn->id.val,
+ __func__, cn->id.idx, cn->id.val,
msg->type, msg->len);
err = -EPROTO;
goto out_cont;
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 03/12] w1: add newlines after declarations
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 01/12] w1: add SPDX identifiers Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 02/12] w1: improve code-style by adhering tp 80 columns per line limit Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 04/12] w1: cleanup whitespaces according to coding style document Steffen Vogel
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, 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 6b3cdc5a09fb..48c20639f75f 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -128,6 +128,7 @@ static ssize_t rw_write(struct file *filp, struct kobject *kobj,
out_up:
mutex_unlock(&sl->master->mutex);
+
return count;
}
@@ -140,6 +141,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;
}
@@ -296,6 +298,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,
char *buf)
{
ssize_t count;
+
count = sprintf(buf, "%d\n", w1_timeout);
+
return count;
}
@@ -313,7 +318,9 @@ static ssize_t w1_master_attribute_show_timeout_us(struct device *dev,
char *buf)
{
ssize_t count;
+
count = sprintf(buf, "%d\n", w1_timeout_us);
+
return count;
}
@@ -375,6 +382,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;
}
@@ -407,8 +415,10 @@ static ssize_t w1_master_attribute_show_add(struct device *dev,
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;
}
@@ -457,6 +467,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 &&
@@ -467,6 +478,7 @@ struct w1_slave *w1_slave_search_device(struct w1_master *dev,
}
}
mutex_unlock(&dev->list_mutex);
+
return NULL;
}
@@ -504,8 +516,10 @@ static ssize_t w1_master_attribute_show_remove(struct device *dev,
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;
}
@@ -684,6 +698,7 @@ static int w1_family_notify(unsigned long action, struct w1_slave *sl)
sysfs_remove_groups(&sl->dev.kobj, fops->groups);
break;
}
+
return 0;
}
@@ -719,6 +734,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);
@@ -787,6 +803,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;
}
@@ -803,6 +820,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) {
@@ -827,6 +845,7 @@ int w1_unref_slave(struct w1_slave *sl)
}
atomic_dec(&dev->refcnt);
mutex_unlock(&dev->list_mutex);
+
return refcnt;
}
@@ -834,6 +853,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);
@@ -841,6 +861,7 @@ int w1_slave_detach(struct w1_slave *sl)
if (destroy_now)
destroy_now = !w1_unref_slave(sl);
+
return destroy_now ? 0 : -EBUSY;
}
@@ -1006,6 +1027,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);
@@ -1141,6 +1163,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 7ef46d8ab059..5e7adc76f643 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);
@@ -166,6 +168,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);
@@ -278,6 +281,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));
@@ -510,6 +514,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;
@@ -528,6 +533,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.
@@ -588,6 +594,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] 13+ messages in thread
* [PATCH v2 04/12] w1: cleanup whitespaces according to coding style document
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
` (2 preceding siblings ...)
2018-10-29 3:03 ` [PATCH v2 03/12] w1: add newlines after declarations Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 05/12] w1: use octal numbers instead of macros for file mode Steffen Vogel
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, Steffen Vogel
These changes fix several warnings emitted by the checkpatch tool.
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
drivers/w1/w1.c | 38 +++++++++++++++++++-------------------
drivers/w1/w1_family.c | 2 +-
drivers/w1/w1_io.c | 40 +++++++++++++++++++++-------------------
drivers/w1/w1_netlink.c | 8 ++++----
4 files changed, 45 insertions(+), 43 deletions(-)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 48c20639f75f..184df1fe216b 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -416,7 +416,7 @@ static ssize_t w1_master_attribute_show_add(struct device *dev,
{
int c = PAGE_SIZE;
- c -= snprintf(buf+PAGE_SIZE - c, c,
+ c -= snprintf(buf + PAGE_SIZE - c, c,
"write device id xx-xxxxxxxxxxxx to add slave\n");
return PAGE_SIZE - c;
@@ -517,7 +517,7 @@ static ssize_t w1_master_attribute_show_remove(struct device *dev,
{
int c = PAGE_SIZE;
- c -= snprintf(buf+PAGE_SIZE - c, c,
+ c -= snprintf(buf + PAGE_SIZE - c, c,
"write device id xx-xxxxxxxxxxxx to remove slave\n");
return PAGE_SIZE - c;
@@ -785,7 +785,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);
@@ -880,7 +880,7 @@ struct w1_master *w1_search_master_id(u32 id)
}
mutex_unlock(&w1_mlock);
- return (found)?dev:NULL;
+ return found ? dev : NULL;
}
struct w1_slave *w1_search_slave(struct w1_reg_num *id)
@@ -909,7 +909,7 @@ struct w1_slave *w1_search_slave(struct w1_reg_num *id)
}
mutex_unlock(&w1_mlock);
- return (found)?sl:NULL;
+ return found ? sl : NULL;
}
void w1_reconnect_slaves(struct w1_family *f, int attach)
@@ -960,7 +960,7 @@ void w1_slave_found(struct w1_master *dev, u64 rn)
atomic_inc(&dev->refcnt);
- tmp = (struct w1_reg_num *) &rn;
+ tmp = (struct w1_reg_num *)&rn;
sl = w1_slave_search_device(dev, tmp);
if (sl) {
@@ -1007,12 +1007,11 @@ 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;
- /*
- * Reset bus and all 1-wire device state machines
+ /* Reset bus and all 1-wire device state machines
* so they can respond to our requests.
*
* Return 0 - device(s) present, 1 - no devices present.
@@ -1059,7 +1058,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 */
@@ -1078,13 +1077,14 @@ void w1_search(struct w1_master *dev, u8 search_type,
}
mutex_unlock(&dev->bus_mutex);
- if ( (triplet_ret & 0x03) != 0x03 ) {
- if ((desc_bit == last_zero) || (last_zero < 0)) {
+ if ((triplet_ret & 0x03) != 0x03) {
+ if (desc_bit == last_zero || last_zero < 0) {
last_device = 1;
dev->search_id = 0;
} else {
dev->search_id = rn;
}
+
desc_bit = last_zero;
cb(dev, rn);
}
@@ -1123,9 +1123,9 @@ 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);
@@ -1156,7 +1156,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;
@@ -1169,7 +1170,7 @@ int w1_process_callbacks(struct w1_master *dev)
int w1_process(void *data)
{
- struct w1_master *dev = (struct w1_master *) data;
+ struct w1_master *dev = (struct w1_master *)data;
/* As long as w1_timeout is only set by a module parameter the sleep
* time can be calculated in jiffies once.
*/
@@ -1179,7 +1180,6 @@ int w1_process(void *data)
unsigned long jremain = 0;
for (;;) {
-
if (!jremain && dev->search_count) {
mutex_lock(&dev->mutex);
w1_search_process(dev, W1_SEARCH);
@@ -1213,9 +1213,9 @@ int w1_process(void *data)
if (!jremain)
jremain = jtime;
jremain = schedule_timeout(jremain);
- }
- else
+ } else {
schedule();
+ }
}
atomic_dec(&dev->refcnt);
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
index f351defbef23..e41e7c375fd2 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 caf07bda18d1..688778cccf65 100644
--- a/drivers/w1/w1_io.c
+++ b/drivers/w1/w1_io.c
@@ -53,12 +53,13 @@ u8 w1_touch_bit(struct w1_master *dev, int bit)
{
if (dev->bus_master->touch_bit)
return dev->bus_master->touch_bit(dev->bus_master->data, bit);
- else if (bit)
+
+ if (bit)
return w1_read_bit(dev);
- else {
- w1_write_bit(dev, 0);
- return 0;
- }
+
+ w1_write_bit(dev, 0);
+
+ return 0;
}
EXPORT_SYMBOL_GPL(w1_touch_bit);
@@ -140,18 +141,17 @@ 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);
-
/**
* w1_read_bit() - Generates a write-1 cycle and samples the level.
* @dev: the master device
@@ -234,11 +234,12 @@ u8 w1_read_8(struct w1_master *dev)
int i;
u8 res = 0;
- if (dev->bus_master->read_byte)
+ 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);
@@ -327,9 +328,9 @@ int w1_reset_bus(struct w1_master *dev)
if (w1_disable_irqs)
local_irq_save(flags);
- if (dev->bus_master->reset_bus)
+ if (dev->bus_master->reset_bus) {
result = dev->bus_master->reset_bus(dev->bus_master->data) & 0x1;
- else {
+ } else {
dev->bus_master->write_bit(dev->bus_master->data, 0);
/* minimum 480, max ? us
* be nice and sleep, except 18b20 spec lists 960us maximum,
@@ -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;
@@ -396,15 +397,16 @@ int w1_reset_select_slave(struct w1_slave *sl)
if (w1_reset_bus(sl->master))
return -1;
- if (sl->master->slave_count == 1)
+ if (sl->master->slave_count == 1) {
w1_write_8(sl->master, W1_SKIP_ROM);
- else {
+ } 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);
}
+
return 0;
}
EXPORT_SYMBOL_GPL(w1_reset_select_slave);
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c
index 5e7adc76f643..9952c99aa3fc 100644
--- a/drivers/w1/w1_netlink.c
+++ b/drivers/w1/w1_netlink.c
@@ -35,6 +35,7 @@ struct w1_cb_block {
* reply first_cn, data (w1_netlink_msg and w1_netlink_cmd)
*/
};
+
struct w1_cb_node {
struct w1_async_cmd async;
/* pointers within w1_cb_block and cn data */
@@ -178,7 +179,7 @@ static void w1_netlink_queue_status(struct w1_cb_block *block,
block->msg->status = (u8)-error;
if (req_cmd) {
struct w1_netlink_cmd *cmd =
- (struct w1_netlink_cmd *) block->msg->data;
+ (struct w1_netlink_cmd *)block->msg->data;
memcpy(cmd, req_cmd, sizeof(*cmd));
block->cn->len += sizeof(*cmd);
@@ -400,7 +401,7 @@ static int w1_process_command_slave(struct w1_slave *sl,
{
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,
+ (unsigned long long)sl->reg_num.id, sl->reg_num.crc, cmd->cmd,
cmd->len);
return w1_process_command_io(sl->master, cmd);
@@ -608,7 +609,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 */
@@ -645,7 +646,6 @@ static void w1_cn_callback(struct cn_msg *cn, struct netlink_skb_parms *nsp)
msg_len = cn->len;
while (msg_len && !err) {
-
dev = NULL;
sl = NULL;
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 05/12] w1: use octal numbers instead of macros for file mode
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
` (3 preceding siblings ...)
2018-10-29 3:03 ` [PATCH v2 04/12] w1: cleanup whitespaces according to coding style document Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 06/12] w1: do not log errors about failed memory allocations Steffen Vogel
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, 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 184df1fe216b..a8ead2350521 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -563,18 +563,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] 13+ messages in thread
* [PATCH v2 06/12] w1: do not log errors about failed memory allocations
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
` (4 preceding siblings ...)
2018-10-29 3:03 ` [PATCH v2 05/12] w1: use octal numbers instead of macros for file mode Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 07/12] w1: use __func__ for logging the function name Steffen Vogel
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, 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 a8ead2350521..cbfc3f7012de 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -757,13 +757,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 efe03b9e23f5..a6c011e57c90 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] 13+ messages in thread
* [PATCH v2 07/12] w1: use __func__ for logging the function name
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
` (5 preceding siblings ...)
2018-10-29 3:03 ` [PATCH v2 06/12] w1: do not log errors about failed memory allocations Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 08/12] w1: improve code-style of struct declarations Steffen Vogel
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, Steffen Vogel
This fixes a warning raised by the checkpatch tool.
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
drivers/w1/w1.c | 5 +++--
drivers/w1/w1_int.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index cbfc3f7012de..4cbe1849fbfc 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -1066,7 +1066,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;
}
}
@@ -1094,7 +1095,7 @@ void w1_search(struct w1_master *dev, u8 search_type,
* bus).
*/
dev_info(&dev->dev, "%s: max_slave_count %d reached, will continue next search.\n",
- __func__, dev->max_slave_count);
+ __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 a6c011e57c90..a5230c0d49e3 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] 13+ messages in thread
* [PATCH v2 08/12] w1: improve code-style of struct declarations
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
` (6 preceding siblings ...)
2018-10-29 3:03 ` [PATCH v2 07/12] w1: use __func__ for logging the function name Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 09/12] w1: using linux instead of asm prefix for includes Steffen Vogel
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, Steffen Vogel
Among improving the readability of the struct declarations,
this fixes a warning about incorrect brace placement
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] 13+ messages in thread
* [PATCH v2 09/12] w1: using linux instead of asm prefix for includes
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
` (7 preceding siblings ...)
2018-10-29 3:03 ` [PATCH v2 08/12] w1: improve code-style of struct declarations Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 10/12] w1: use pointers instead of types to determine size of allocs Steffen Vogel
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, 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 688778cccf65..65384b332a5a 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] 13+ messages in thread
* [PATCH v2 10/12] w1: use pointers instead of types to determine size of allocs
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
` (8 preceding siblings ...)
2018-10-29 3:03 ` [PATCH v2 09/12] w1: using linux instead of asm prefix for includes Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 11/12] w1: replace non-standard %LX format-string by %llX Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 12/12] w1: fix typo in comment Steffen Vogel
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, Steffen Vogel
Get size of allocation based on pointer not type.
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
drivers/w1/w1.c | 2 +-
drivers/w1/w1_int.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 4cbe1849fbfc..87094d99ccbe 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -756,7 +756,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
int err;
struct w1_netlink_msg msg;
- sl = kzalloc(sizeof(struct w1_slave), GFP_KERNEL);
+ sl = kzalloc(sizeof(*sl), GFP_KERNEL);
if (!sl)
return -ENOMEM;
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index a5230c0d49e3..2bf7631ac24f 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -31,7 +31,7 @@ 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) +
+ dev = kzalloc(sizeof(*dev) +
sizeof(struct w1_bus_master), GFP_KERNEL);
if (!dev)
return NULL;
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 11/12] w1: replace non-standard %LX format-string by %llX
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
` (9 preceding siblings ...)
2018-10-29 3:03 ` [PATCH v2 10/12] w1: use pointers instead of types to determine size of allocs Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 12/12] w1: fix typo in comment Steffen Vogel
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, Steffen Vogel
As indicated by checkpatch.pl script.
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
drivers/w1/w1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 87094d99ccbe..1326bd52888a 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -636,7 +636,7 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
if (err)
goto end;
- err = add_uevent_var(env, "W1_SLAVE_ID=%024LX",
+ err = add_uevent_var(env, "W1_SLAVE_ID=%024llX",
(unsigned long long)sl->reg_num.id);
end:
return err;
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 12/12] w1: fix typo in comment
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
` (10 preceding siblings ...)
2018-10-29 3:03 ` [PATCH v2 11/12] w1: replace non-standard %LX format-string by %llX Steffen Vogel
@ 2018-10-29 3:03 ` Steffen Vogel
11 siblings, 0 replies; 13+ messages in thread
From: Steffen Vogel @ 2018-10-29 3:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Evgeniy Polyakov, Joe Perches, Steffen Vogel
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
---
drivers/w1/w1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 1326bd52888a..94747eeff0fa 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -1196,7 +1196,7 @@ int w1_process(void *data)
__set_current_state(TASK_INTERRUPTIBLE);
- /* hold list_mutex until after interruptible to prevent loosing
+ /* hold list_mutex until after interruptible to prevent losing
* the wakeup signal when async_cmd is added.
*/
mutex_unlock(&dev->list_mutex);
--
2.11.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2018-10-29 3:16 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-29 3:03 [PATCH v2 00/11] w1: coding style and checkpatch fixes Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 01/12] w1: add SPDX identifiers Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 02/12] w1: improve code-style by adhering tp 80 columns per line limit Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 03/12] w1: add newlines after declarations Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 04/12] w1: cleanup whitespaces according to coding style document Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 05/12] w1: use octal numbers instead of macros for file mode Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 06/12] w1: do not log errors about failed memory allocations Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 07/12] w1: use __func__ for logging the function name Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 08/12] w1: improve code-style of struct declarations Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 09/12] w1: using linux instead of asm prefix for includes Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 10/12] w1: use pointers instead of types to determine size of allocs Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 11/12] w1: replace non-standard %LX format-string by %llX Steffen Vogel
2018-10-29 3:03 ` [PATCH v2 12/12] w1: fix typo in comment Steffen Vogel
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).