Lines Matching refs:cdev
37 void cosm_set_shutdown_status(struct cosm_device *cdev, u8 shutdown_status) in cosm_set_shutdown_status() argument
39 dev_dbg(&cdev->dev, "Shutdown Status %s -> %s\n", in cosm_set_shutdown_status()
40 cosm_shutdown_status_string[cdev->shutdown_status], in cosm_set_shutdown_status()
42 cdev->shutdown_status = shutdown_status; in cosm_set_shutdown_status()
45 void cosm_set_state(struct cosm_device *cdev, u8 state) in cosm_set_state() argument
47 dev_dbg(&cdev->dev, "State %s -> %s\n", in cosm_set_state()
48 cosm_state_string[cdev->state], in cosm_set_state()
50 cdev->state = state; in cosm_set_state()
51 sysfs_notify_dirent(cdev->state_sysfs); in cosm_set_state()
57 struct cosm_device *cdev = dev_get_drvdata(dev); in family_show() local
59 if (!cdev) in family_show()
62 return cdev->hw_ops->family(cdev, buf); in family_show()
69 struct cosm_device *cdev = dev_get_drvdata(dev); in stepping_show() local
71 if (!cdev) in stepping_show()
74 return cdev->hw_ops->stepping(cdev, buf); in stepping_show()
81 struct cosm_device *cdev = dev_get_drvdata(dev); in state_show() local
83 if (!cdev || cdev->state >= MIC_LAST) in state_show()
87 cosm_state_string[cdev->state]); in state_show()
94 struct cosm_device *cdev = dev_get_drvdata(dev); in state_store() local
97 if (!cdev) in state_store()
101 rc = cosm_start(cdev); in state_store()
105 rc = cosm_reset(cdev); in state_store()
110 rc = cosm_shutdown(cdev); in state_store()
124 struct cosm_device *cdev = dev_get_drvdata(dev); in shutdown_status_show() local
126 if (!cdev || cdev->shutdown_status >= MIC_STATUS_LAST) in shutdown_status_show()
130 cosm_shutdown_status_string[cdev->shutdown_status]); in shutdown_status_show()
138 struct cosm_device *cdev = dev_get_drvdata(dev); in heartbeat_enable_show() local
140 if (!cdev) in heartbeat_enable_show()
143 return scnprintf(buf, PAGE_SIZE, "%d\n", cdev->sysfs_heartbeat_enable); in heartbeat_enable_show()
151 struct cosm_device *cdev = dev_get_drvdata(dev); in heartbeat_enable_store() local
155 if (!cdev) in heartbeat_enable_store()
158 mutex_lock(&cdev->cosm_mutex); in heartbeat_enable_store()
163 cdev->sysfs_heartbeat_enable = enable; in heartbeat_enable_store()
165 if (cdev->state == MIC_ONLINE) in heartbeat_enable_store()
166 cdev->heartbeat_watchdog_enable = enable; in heartbeat_enable_store()
169 mutex_unlock(&cdev->cosm_mutex); in heartbeat_enable_store()
177 struct cosm_device *cdev = dev_get_drvdata(dev); in cmdline_show() local
180 if (!cdev) in cmdline_show()
183 cmdline = cdev->cmdline; in cmdline_show()
194 struct cosm_device *cdev = dev_get_drvdata(dev); in cmdline_store() local
196 if (!cdev) in cmdline_store()
199 mutex_lock(&cdev->cosm_mutex); in cmdline_store()
200 kfree(cdev->cmdline); in cmdline_store()
202 cdev->cmdline = kmalloc(count + 1, GFP_KERNEL); in cmdline_store()
203 if (!cdev->cmdline) { in cmdline_store()
208 strncpy(cdev->cmdline, buf, count); in cmdline_store()
210 if (cdev->cmdline[count - 1] == '\n') in cmdline_store()
211 cdev->cmdline[count - 1] = '\0'; in cmdline_store()
213 cdev->cmdline[count] = '\0'; in cmdline_store()
215 mutex_unlock(&cdev->cosm_mutex); in cmdline_store()
223 struct cosm_device *cdev = dev_get_drvdata(dev); in firmware_show() local
226 if (!cdev) in firmware_show()
229 firmware = cdev->firmware; in firmware_show()
240 struct cosm_device *cdev = dev_get_drvdata(dev); in firmware_store() local
242 if (!cdev) in firmware_store()
245 mutex_lock(&cdev->cosm_mutex); in firmware_store()
246 kfree(cdev->firmware); in firmware_store()
248 cdev->firmware = kmalloc(count + 1, GFP_KERNEL); in firmware_store()
249 if (!cdev->firmware) { in firmware_store()
253 strncpy(cdev->firmware, buf, count); in firmware_store()
255 if (cdev->firmware[count - 1] == '\n') in firmware_store()
256 cdev->firmware[count - 1] = '\0'; in firmware_store()
258 cdev->firmware[count] = '\0'; in firmware_store()
260 mutex_unlock(&cdev->cosm_mutex); in firmware_store()
268 struct cosm_device *cdev = dev_get_drvdata(dev); in ramdisk_show() local
271 if (!cdev) in ramdisk_show()
274 ramdisk = cdev->ramdisk; in ramdisk_show()
285 struct cosm_device *cdev = dev_get_drvdata(dev); in ramdisk_store() local
287 if (!cdev) in ramdisk_store()
290 mutex_lock(&cdev->cosm_mutex); in ramdisk_store()
291 kfree(cdev->ramdisk); in ramdisk_store()
293 cdev->ramdisk = kmalloc(count + 1, GFP_KERNEL); in ramdisk_store()
294 if (!cdev->ramdisk) { in ramdisk_store()
299 strncpy(cdev->ramdisk, buf, count); in ramdisk_store()
301 if (cdev->ramdisk[count - 1] == '\n') in ramdisk_store()
302 cdev->ramdisk[count - 1] = '\0'; in ramdisk_store()
304 cdev->ramdisk[count] = '\0'; in ramdisk_store()
306 mutex_unlock(&cdev->cosm_mutex); in ramdisk_store()
314 struct cosm_device *cdev = dev_get_drvdata(dev); in bootmode_show() local
317 if (!cdev) in bootmode_show()
320 bootmode = cdev->bootmode; in bootmode_show()
331 struct cosm_device *cdev = dev_get_drvdata(dev); in bootmode_store() local
333 if (!cdev) in bootmode_store()
339 mutex_lock(&cdev->cosm_mutex); in bootmode_store()
340 kfree(cdev->bootmode); in bootmode_store()
342 cdev->bootmode = kmalloc(count + 1, GFP_KERNEL); in bootmode_store()
343 if (!cdev->bootmode) { in bootmode_store()
348 strncpy(cdev->bootmode, buf, count); in bootmode_store()
350 if (cdev->bootmode[count - 1] == '\n') in bootmode_store()
351 cdev->bootmode[count - 1] = '\0'; in bootmode_store()
353 cdev->bootmode[count] = '\0'; in bootmode_store()
355 mutex_unlock(&cdev->cosm_mutex); in bootmode_store()
364 struct cosm_device *cdev = dev_get_drvdata(dev); in log_buf_addr_show() local
366 if (!cdev) in log_buf_addr_show()
369 return scnprintf(buf, PAGE_SIZE, "%p\n", cdev->log_buf_addr); in log_buf_addr_show()
376 struct cosm_device *cdev = dev_get_drvdata(dev); in log_buf_addr_store() local
380 if (!cdev) in log_buf_addr_store()
387 cdev->log_buf_addr = (void *)addr; in log_buf_addr_store()
398 struct cosm_device *cdev = dev_get_drvdata(dev); in log_buf_len_show() local
400 if (!cdev) in log_buf_len_show()
403 return scnprintf(buf, PAGE_SIZE, "%p\n", cdev->log_buf_len); in log_buf_len_show()
410 struct cosm_device *cdev = dev_get_drvdata(dev); in log_buf_len_store() local
414 if (!cdev) in log_buf_len_store()
421 cdev->log_buf_len = (int *)addr; in log_buf_len_store()
446 void cosm_sysfs_init(struct cosm_device *cdev) in cosm_sysfs_init() argument
448 cdev->attr_group = cosm_default_groups; in cosm_sysfs_init()