Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

w1: mxc_w1: Driver cleanup

- Remove old and currently wrong address of the FSF from license
parts of the code.
- Remove unused #include and sort remaining headers alphabetically.
- Remove unised definitions.
- Add definitions for bit-fields.
- Add missing module owner field.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alexander Shiyan and committed by
Greg Kroah-Hartman
18fd9e35 aea476b5

+16 -23
+16 -23
drivers/w1/masters/mxc_w1.c
··· 10 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 12 * GNU General Public License for more details. 13 - * 14 - * You should have received a copy of the GNU General Public License 15 - * along with this program; if not, write to the Free Software 16 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 - * 18 13 */ 19 14 20 - #include <linux/module.h> 21 - #include <linux/interrupt.h> 22 - #include <linux/platform_device.h> 23 15 #include <linux/clk.h> 24 - #include <linux/slab.h> 25 16 #include <linux/delay.h> 26 17 #include <linux/io.h> 18 + #include <linux/module.h> 19 + #include <linux/platform_device.h> 27 20 28 21 #include "../w1.h" 29 22 #include "../w1_int.h" 30 - #include "../w1_log.h" 31 23 32 24 /* According to the mx27 Datasheet the reset procedure should take up to about 33 25 * 1350us. We set the timeout to 500*100us = 50ms for sure */ ··· 28 36 /* 29 37 * MXC W1 Register offsets 30 38 */ 31 - #define MXC_W1_CONTROL 0x00 32 - #define MXC_W1_TIME_DIVIDER 0x02 33 - #define MXC_W1_RESET 0x04 34 - #define MXC_W1_COMMAND 0x06 35 - #define MXC_W1_TXRX 0x08 36 - #define MXC_W1_INTERRUPT 0x0A 37 - #define MXC_W1_INTERRUPT_EN 0x0C 39 + #define MXC_W1_CONTROL 0x00 40 + # define MXC_W1_CONTROL_RDST BIT(3) 41 + # define MXC_W1_CONTROL_WR(x) BIT(5 - (x)) 42 + # define MXC_W1_CONTROL_PST BIT(6) 43 + # define MXC_W1_CONTROL_RPP BIT(7) 44 + #define MXC_W1_TIME_DIVIDER 0x02 45 + #define MXC_W1_RESET 0x04 38 46 39 47 struct mxc_w1_device { 40 48 void __iomem *regs; ··· 53 61 unsigned int timeout_cnt = 0; 54 62 struct mxc_w1_device *dev = data; 55 63 56 - __raw_writeb(0x80, (dev->regs + MXC_W1_CONTROL)); 64 + __raw_writeb(MXC_W1_CONTROL_RPP, (dev->regs + MXC_W1_CONTROL)); 57 65 58 66 while (1) { 59 67 reg_val = __raw_readb(dev->regs + MXC_W1_CONTROL); 60 68 61 - if (((reg_val >> 7) & 0x1) == 0 || 69 + if (!(reg_val & MXC_W1_CONTROL_RPP) || 62 70 timeout_cnt > MXC_W1_RESET_TIMEOUT) 63 71 break; 64 72 else ··· 66 74 67 75 udelay(100); 68 76 } 69 - return (reg_val >> 6) & 0x1; 77 + return !!(reg_val & MXC_W1_CONTROL_PST); 70 78 } 71 79 72 80 /* ··· 82 90 * datasheet. 83 91 */ 84 92 85 - __raw_writeb((1 << (5 - bit)), ctrl_addr); 93 + __raw_writeb(MXC_W1_CONTROL_WR(bit), ctrl_addr); 86 94 87 95 while (timeout_cnt--) { 88 - if (!((__raw_readb(ctrl_addr) >> (5 - bit)) & 0x1)) 96 + if (!(__raw_readb(ctrl_addr) & MXC_W1_CONTROL_WR(bit))) 89 97 break; 90 98 91 99 udelay(1); 92 100 } 93 101 94 - return ((__raw_readb(ctrl_addr)) >> 3) & 0x1; 102 + return !!(__raw_readb(ctrl_addr) & MXC_W1_CONTROL_RDST); 95 103 } 96 104 97 105 static int mxc_w1_probe(struct platform_device *pdev) ··· 169 177 static struct platform_driver mxc_w1_driver = { 170 178 .driver = { 171 179 .name = "mxc_w1", 180 + .owner = THIS_MODULE, 172 181 .of_match_table = mxc_w1_dt_ids, 173 182 }, 174 183 .probe = mxc_w1_probe,