Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Thomas Horsten <thh@lasat.com> |
| 3 | * Copyright (C) 2000 LASAT Networks A/S. |
| 4 | * |
| 5 | * This program is free software; you can distribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License (Version 2) as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | * for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along |
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. |
| 17 | * |
| 18 | * Routines specific to the LASAT boards |
| 19 | */ |
| 20 | #include <linux/types.h> |
| 21 | #include <asm/lasat/lasat.h> |
| 22 | |
| 23 | #include <linux/module.h> |
| 24 | #include <linux/sysctl.h> |
| 25 | #include <linux/stddef.h> |
| 26 | #include <linux/init.h> |
| 27 | #include <linux/fs.h> |
| 28 | #include <linux/ctype.h> |
| 29 | #include <linux/string.h> |
| 30 | #include <linux/net.h> |
| 31 | #include <linux/inet.h> |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 32 | #include <linux/uaccess.h> |
| 33 | |
Ralf Baechle | 4b55048 | 2007-10-11 23:46:08 +0100 | [diff] [blame] | 34 | #include <asm/time.h> |
| 35 | |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 36 | #ifdef CONFIG_DS1603 |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 37 | #include "ds1603.h" |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 38 | #endif |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 39 | |
| 40 | /* Strategy function to write EEPROM after changing string entry */ |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 41 | int sysctl_lasatstring(ctl_table *table, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 42 | void *oldval, size_t *oldlenp, |
| 43 | void *newval, size_t newlen) |
| 44 | { |
| 45 | int r; |
| 46 | |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 47 | r = sysctl_string(table, oldval, oldlenp, newval, newlen); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 48 | if (r < 0) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 49 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 50 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 51 | if (newval && newlen) |
| 52 | lasat_write_eeprom_info(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 53 | |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 54 | return 0; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | |
| 58 | /* And the same for proc */ |
| 59 | int proc_dolasatstring(ctl_table *table, int write, struct file *filp, |
| 60 | void *buffer, size_t *lenp, loff_t *ppos) |
| 61 | { |
| 62 | int r; |
| 63 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 64 | r = proc_dostring(table, write, filp, buffer, lenp, ppos); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 65 | if ((!write) || r) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 66 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 67 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 68 | lasat_write_eeprom_info(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 69 | |
| 70 | return 0; |
| 71 | } |
| 72 | |
| 73 | /* proc function to write EEPROM after changing int entry */ |
| 74 | int proc_dolasatint(ctl_table *table, int write, struct file *filp, |
| 75 | void *buffer, size_t *lenp, loff_t *ppos) |
| 76 | { |
| 77 | int r; |
| 78 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 79 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 80 | if ((!write) || r) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 81 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 82 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 83 | lasat_write_eeprom_info(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 84 | |
| 85 | return 0; |
| 86 | } |
| 87 | |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 88 | #ifdef CONFIG_DS1603 |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 89 | static int rtctmp; |
| 90 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 91 | /* proc function to read/write RealTime Clock */ |
| 92 | int proc_dolasatrtc(ctl_table *table, int write, struct file *filp, |
| 93 | void *buffer, size_t *lenp, loff_t *ppos) |
| 94 | { |
| 95 | int r; |
| 96 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 97 | if (!write) { |
Ralf Baechle | 4b55048 | 2007-10-11 23:46:08 +0100 | [diff] [blame] | 98 | rtctmp = read_persistent_clock(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 99 | /* check for time < 0 and set to 0 */ |
| 100 | if (rtctmp < 0) |
| 101 | rtctmp = 0; |
| 102 | } |
| 103 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 104 | if (r) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 105 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 106 | |
| 107 | if (write) |
| 108 | rtc_mips_set_mmss(rtctmp); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 109 | |
| 110 | return 0; |
| 111 | } |
| 112 | #endif |
| 113 | |
| 114 | /* Sysctl for setting the IP addresses */ |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 115 | int sysctl_lasat_intvec(ctl_table *table, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 116 | void *oldval, size_t *oldlenp, |
| 117 | void *newval, size_t newlen) |
| 118 | { |
| 119 | int r; |
| 120 | |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 121 | r = sysctl_intvec(table, oldval, oldlenp, newval, newlen); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 122 | if (r < 0) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 123 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 124 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 125 | if (newval && newlen) |
| 126 | lasat_write_eeprom_info(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 127 | |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 128 | return 0; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | #ifdef CONFIG_DS1603 |
| 132 | /* Same for RTC */ |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 133 | int sysctl_lasat_rtc(ctl_table *table, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 134 | void *oldval, size_t *oldlenp, |
| 135 | void *newval, size_t newlen) |
| 136 | { |
| 137 | int r; |
| 138 | |
Ralf Baechle | 4b55048 | 2007-10-11 23:46:08 +0100 | [diff] [blame] | 139 | rtctmp = read_persistent_clock(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 140 | if (rtctmp < 0) |
| 141 | rtctmp = 0; |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 142 | r = sysctl_intvec(table, oldval, oldlenp, newval, newlen); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 143 | if (r < 0) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 144 | return r; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 145 | if (newval && newlen) |
Ralf Baechle | 4b55048 | 2007-10-11 23:46:08 +0100 | [diff] [blame] | 146 | rtc_mips_set_mmss(rtctmp); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 147 | |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 148 | return r; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 149 | } |
| 150 | #endif |
| 151 | |
| 152 | #ifdef CONFIG_INET |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 153 | int proc_lasat_ip(ctl_table *table, int write, struct file *filp, |
| 154 | void *buffer, size_t *lenp, loff_t *ppos) |
| 155 | { |
| 156 | unsigned int ip; |
| 157 | char *p, c; |
| 158 | int len; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 159 | char ipbuf[32]; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 160 | |
| 161 | if (!table->data || !table->maxlen || !*lenp || |
| 162 | (*ppos && !write)) { |
| 163 | *lenp = 0; |
| 164 | return 0; |
| 165 | } |
| 166 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 167 | if (write) { |
| 168 | len = 0; |
| 169 | p = buffer; |
| 170 | while (len < *lenp) { |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 171 | if (get_user(c, p++)) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 172 | return -EFAULT; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 173 | if (c == 0 || c == '\n') |
| 174 | break; |
| 175 | len++; |
| 176 | } |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 177 | if (len >= sizeof(ipbuf)-1) |
| 178 | len = sizeof(ipbuf) - 1; |
| 179 | if (copy_from_user(ipbuf, buffer, len)) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 180 | return -EFAULT; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 181 | ipbuf[len] = 0; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 182 | *ppos += *lenp; |
| 183 | /* Now see if we can convert it to a valid IP */ |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 184 | ip = in_aton(ipbuf); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 185 | *(unsigned int *)(table->data) = ip; |
| 186 | lasat_write_eeprom_info(); |
| 187 | } else { |
| 188 | ip = *(unsigned int *)(table->data); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 189 | sprintf(ipbuf, "%d.%d.%d.%d", |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 190 | (ip) & 0xff, |
| 191 | (ip >> 8) & 0xff, |
| 192 | (ip >> 16) & 0xff, |
| 193 | (ip >> 24) & 0xff); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 194 | len = strlen(ipbuf); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 195 | if (len > *lenp) |
| 196 | len = *lenp; |
| 197 | if (len) |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 198 | if (copy_to_user(buffer, ipbuf, len)) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 199 | return -EFAULT; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 200 | if (len < *lenp) { |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 201 | if (put_user('\n', ((char *) buffer) + len)) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 202 | return -EFAULT; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 203 | len++; |
| 204 | } |
| 205 | *lenp = len; |
| 206 | *ppos += len; |
| 207 | } |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 208 | |
| 209 | return 0; |
| 210 | } |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 211 | #endif |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 212 | |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 213 | static int sysctl_lasat_prid(ctl_table *table, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 214 | void *oldval, size_t *oldlenp, |
| 215 | void *newval, size_t newlen) |
| 216 | { |
| 217 | int r; |
| 218 | |
Alexey Dobriyan | f221e72 | 2008-10-15 22:04:23 -0700 | [diff] [blame] | 219 | r = sysctl_intvec(table, oldval, oldlenp, newval, newlen); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 220 | if (r < 0) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 221 | return r; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 222 | if (newval && newlen) { |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 223 | lasat_board_info.li_eeprom_info.prid = *(int *)newval; |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 224 | lasat_write_eeprom_info(); |
| 225 | lasat_init_board_info(); |
| 226 | } |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 227 | return 0; |
| 228 | } |
| 229 | |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 230 | int proc_lasat_prid(ctl_table *table, int write, struct file *filp, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 231 | void *buffer, size_t *lenp, loff_t *ppos) |
| 232 | { |
| 233 | int r; |
| 234 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 235 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 236 | if (r < 0) |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 237 | return r; |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 238 | if (write) { |
| 239 | lasat_board_info.li_eeprom_info.prid = |
| 240 | lasat_board_info.li_prid; |
| 241 | lasat_write_eeprom_info(); |
| 242 | lasat_init_board_info(); |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 243 | } |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 244 | return 0; |
| 245 | } |
| 246 | |
| 247 | extern int lasat_boot_to_service; |
| 248 | |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 249 | static ctl_table lasat_table[] = { |
| 250 | { |
| 251 | .ctl_name = CTL_UNNUMBERED, |
| 252 | .procname = "cpu-hz", |
| 253 | .data = &lasat_board_info.li_cpu_hz, |
| 254 | .maxlen = sizeof(int), |
| 255 | .mode = 0444, |
| 256 | .proc_handler = &proc_dointvec, |
| 257 | .strategy = &sysctl_intvec |
| 258 | }, |
| 259 | { |
| 260 | .ctl_name = CTL_UNNUMBERED, |
| 261 | .procname = "bus-hz", |
| 262 | .data = &lasat_board_info.li_bus_hz, |
| 263 | .maxlen = sizeof(int), |
| 264 | .mode = 0444, |
| 265 | .proc_handler = &proc_dointvec, |
| 266 | .strategy = &sysctl_intvec |
| 267 | }, |
| 268 | { |
| 269 | .ctl_name = CTL_UNNUMBERED, |
| 270 | .procname = "bmid", |
| 271 | .data = &lasat_board_info.li_bmid, |
| 272 | .maxlen = sizeof(int), |
| 273 | .mode = 0444, |
| 274 | .proc_handler = &proc_dointvec, |
| 275 | .strategy = &sysctl_intvec |
| 276 | }, |
| 277 | { |
| 278 | .ctl_name = CTL_UNNUMBERED, |
| 279 | .procname = "prid", |
| 280 | .data = &lasat_board_info.li_prid, |
| 281 | .maxlen = sizeof(int), |
| 282 | .mode = 0644, |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 283 | .proc_handler = &proc_lasat_prid, |
| 284 | .strategy = &sysctl_lasat_prid |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 285 | }, |
| 286 | #ifdef CONFIG_INET |
| 287 | { |
| 288 | .ctl_name = CTL_UNNUMBERED, |
| 289 | .procname = "ipaddr", |
| 290 | .data = &lasat_board_info.li_eeprom_info.ipaddr, |
| 291 | .maxlen = sizeof(int), |
| 292 | .mode = 0644, |
| 293 | .proc_handler = &proc_lasat_ip, |
| 294 | .strategy = &sysctl_lasat_intvec |
| 295 | }, |
| 296 | { |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 297 | .ctl_name = CTL_UNNUMBERED, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 298 | .procname = "netmask", |
| 299 | .data = &lasat_board_info.li_eeprom_info.netmask, |
| 300 | .maxlen = sizeof(int), |
| 301 | .mode = 0644, |
| 302 | .proc_handler = &proc_lasat_ip, |
| 303 | .strategy = &sysctl_lasat_intvec |
| 304 | }, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 305 | #endif |
| 306 | { |
| 307 | .ctl_name = CTL_UNNUMBERED, |
| 308 | .procname = "passwd_hash", |
| 309 | .data = &lasat_board_info.li_eeprom_info.passwd_hash, |
| 310 | .maxlen = |
| 311 | sizeof(lasat_board_info.li_eeprom_info.passwd_hash), |
| 312 | .mode = 0600, |
| 313 | .proc_handler = &proc_dolasatstring, |
| 314 | .strategy = &sysctl_lasatstring |
| 315 | }, |
| 316 | { |
| 317 | .ctl_name = CTL_UNNUMBERED, |
| 318 | .procname = "boot-service", |
| 319 | .data = &lasat_boot_to_service, |
| 320 | .maxlen = sizeof(int), |
| 321 | .mode = 0644, |
| 322 | .proc_handler = &proc_dointvec, |
| 323 | .strategy = &sysctl_intvec |
| 324 | }, |
| 325 | #ifdef CONFIG_DS1603 |
| 326 | { |
| 327 | .ctl_name = CTL_UNNUMBERED, |
| 328 | .procname = "rtc", |
| 329 | .data = &rtctmp, |
| 330 | .maxlen = sizeof(int), |
| 331 | .mode = 0644, |
| 332 | .proc_handler = &proc_dolasatrtc, |
| 333 | .strategy = &sysctl_lasat_rtc |
| 334 | }, |
| 335 | #endif |
| 336 | { |
| 337 | .ctl_name = CTL_UNNUMBERED, |
| 338 | .procname = "namestr", |
| 339 | .data = &lasat_board_info.li_namestr, |
| 340 | .maxlen = sizeof(lasat_board_info.li_namestr), |
| 341 | .mode = 0444, |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 342 | .proc_handler = &proc_dostring, |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 343 | .strategy = &sysctl_string |
| 344 | }, |
| 345 | { |
| 346 | .ctl_name = CTL_UNNUMBERED, |
| 347 | .procname = "typestr", |
| 348 | .data = &lasat_board_info.li_typestr, |
| 349 | .maxlen = sizeof(lasat_board_info.li_typestr), |
| 350 | .mode = 0444, |
| 351 | .proc_handler = &proc_dostring, |
| 352 | .strategy = &sysctl_string |
| 353 | }, |
| 354 | {} |
| 355 | }; |
| 356 | |
| 357 | static ctl_table lasat_root_table[] = { |
| 358 | { |
| 359 | .ctl_name = CTL_UNNUMBERED, |
| 360 | .procname = "lasat", |
| 361 | .mode = 0555, |
| 362 | .child = lasat_table |
| 363 | }, |
| 364 | {} |
| 365 | }; |
| 366 | |
| 367 | static int __init lasat_register_sysctl(void) |
| 368 | { |
| 369 | struct ctl_table_header *lasat_table_header; |
| 370 | |
| 371 | lasat_table_header = |
| 372 | register_sysctl_table(lasat_root_table); |
Thomas Horsten | 1f34f2e | 2008-06-15 02:17:11 +0100 | [diff] [blame] | 373 | if (!lasat_table_header) { |
| 374 | printk(KERN_ERR "Unable to register LASAT sysctl\n"); |
| 375 | return -ENOMEM; |
| 376 | } |
Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 377 | |
| 378 | return 0; |
| 379 | } |
| 380 | |
| 381 | __initcall(lasat_register_sysctl); |