xref: /openbmc/linux/drivers/w1/slaves/w1_smem.c (revision ee8ff16b)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  *	w1_smem.c
4  *
5  * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
6  */
7 
8 #include <asm/types.h>
9 
10 #include <linux/kernel.h>
11 #include <linux/module.h>
12 #include <linux/moduleparam.h>
13 #include <linux/device.h>
14 #include <linux/types.h>
15 
16 #include <linux/w1.h>
17 
18 #define W1_FAMILY_SMEM_01	0x01
19 #define W1_FAMILY_SMEM_81	0x81
20 
21 static struct w1_family w1_smem_family_01 = {
22 	.fid = W1_FAMILY_SMEM_01,
23 };
24 
25 static struct w1_family w1_smem_family_81 = {
26 	.fid = W1_FAMILY_SMEM_81,
27 };
28 
w1_smem_init(void)29 static int __init w1_smem_init(void)
30 {
31 	int err;
32 
33 	err = w1_register_family(&w1_smem_family_01);
34 	if (err)
35 		return err;
36 
37 	err = w1_register_family(&w1_smem_family_81);
38 	if (err) {
39 		w1_unregister_family(&w1_smem_family_01);
40 		return err;
41 	}
42 
43 	return 0;
44 }
45 
w1_smem_fini(void)46 static void __exit w1_smem_fini(void)
47 {
48 	w1_unregister_family(&w1_smem_family_01);
49 	w1_unregister_family(&w1_smem_family_81);
50 }
51 
52 module_init(w1_smem_init);
53 module_exit(w1_smem_fini);
54 
55 MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>");
56 MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family.");
57 MODULE_LICENSE("GPL");
58 MODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_SMEM_01));
59 MODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_SMEM_81));
60