Lines Matching refs:cdev

49 void cosm_set_shutdown_status(struct cosm_device *cdev, u8 shutdown_status)  in cosm_set_shutdown_status()  argument
51 dev_dbg(&cdev->dev, "Shutdown Status %s -> %s\n", in cosm_set_shutdown_status()
52 cosm_shutdown_status_string[cdev->shutdown_status], in cosm_set_shutdown_status()
54 cdev->shutdown_status = shutdown_status; in cosm_set_shutdown_status()
57 void cosm_set_state(struct cosm_device *cdev, u8 state) in cosm_set_state() argument
59 dev_dbg(&cdev->dev, "State %s -> %s\n", in cosm_set_state()
60 cosm_state_string[cdev->state], in cosm_set_state()
62 cdev->state = state; in cosm_set_state()
63 sysfs_notify_dirent(cdev->state_sysfs); in cosm_set_state()
69 struct cosm_device *cdev = dev_get_drvdata(dev); in family_show() local
71 if (!cdev) in family_show()
74 return cdev->hw_ops->family(cdev, buf); in family_show()
81 struct cosm_device *cdev = dev_get_drvdata(dev); in stepping_show() local
83 if (!cdev) in stepping_show()
86 return cdev->hw_ops->stepping(cdev, buf); in stepping_show()
93 struct cosm_device *cdev = dev_get_drvdata(dev); in state_show() local
95 if (!cdev || cdev->state >= MIC_LAST) in state_show()
99 cosm_state_string[cdev->state]); in state_show()
106 struct cosm_device *cdev = dev_get_drvdata(dev); in state_store() local
109 if (!cdev) in state_store()
113 rc = cosm_start(cdev); in state_store()
117 rc = cosm_reset(cdev); in state_store()
122 rc = cosm_shutdown(cdev); in state_store()
136 struct cosm_device *cdev = dev_get_drvdata(dev); in shutdown_status_show() local
138 if (!cdev || cdev->shutdown_status >= MIC_STATUS_LAST) in shutdown_status_show()
142 cosm_shutdown_status_string[cdev->shutdown_status]); in shutdown_status_show()
150 struct cosm_device *cdev = dev_get_drvdata(dev); in heartbeat_enable_show() local
152 if (!cdev) in heartbeat_enable_show()
155 return scnprintf(buf, PAGE_SIZE, "%d\n", cdev->sysfs_heartbeat_enable); in heartbeat_enable_show()
163 struct cosm_device *cdev = dev_get_drvdata(dev); in heartbeat_enable_store() local
167 if (!cdev) in heartbeat_enable_store()
170 mutex_lock(&cdev->cosm_mutex); in heartbeat_enable_store()
175 cdev->sysfs_heartbeat_enable = enable; in heartbeat_enable_store()
177 if (cdev->state == MIC_ONLINE) in heartbeat_enable_store()
178 cdev->heartbeat_watchdog_enable = enable; in heartbeat_enable_store()
181 mutex_unlock(&cdev->cosm_mutex); in heartbeat_enable_store()
189 struct cosm_device *cdev = dev_get_drvdata(dev); in cmdline_show() local
192 if (!cdev) in cmdline_show()
195 cmdline = cdev->cmdline; in cmdline_show()
206 struct cosm_device *cdev = dev_get_drvdata(dev); in cmdline_store() local
208 if (!cdev) in cmdline_store()
211 mutex_lock(&cdev->cosm_mutex); in cmdline_store()
212 kfree(cdev->cmdline); in cmdline_store()
214 cdev->cmdline = kmalloc(count + 1, GFP_KERNEL); in cmdline_store()
215 if (!cdev->cmdline) { in cmdline_store()
220 strncpy(cdev->cmdline, buf, count); in cmdline_store()
222 if (cdev->cmdline[count - 1] == '\n') in cmdline_store()
223 cdev->cmdline[count - 1] = '\0'; in cmdline_store()
225 cdev->cmdline[count] = '\0'; in cmdline_store()
227 mutex_unlock(&cdev->cosm_mutex); in cmdline_store()
235 struct cosm_device *cdev = dev_get_drvdata(dev); in firmware_show() local
238 if (!cdev) in firmware_show()
241 firmware = cdev->firmware; in firmware_show()
252 struct cosm_device *cdev = dev_get_drvdata(dev); in firmware_store() local
254 if (!cdev) in firmware_store()
257 mutex_lock(&cdev->cosm_mutex); in firmware_store()
258 kfree(cdev->firmware); in firmware_store()
260 cdev->firmware = kmalloc(count + 1, GFP_KERNEL); in firmware_store()
261 if (!cdev->firmware) { in firmware_store()
265 strncpy(cdev->firmware, buf, count); in firmware_store()
267 if (cdev->firmware[count - 1] == '\n') in firmware_store()
268 cdev->firmware[count - 1] = '\0'; in firmware_store()
270 cdev->firmware[count] = '\0'; in firmware_store()
272 mutex_unlock(&cdev->cosm_mutex); in firmware_store()
280 struct cosm_device *cdev = dev_get_drvdata(dev); in ramdisk_show() local
283 if (!cdev) in ramdisk_show()
286 ramdisk = cdev->ramdisk; in ramdisk_show()
297 struct cosm_device *cdev = dev_get_drvdata(dev); in ramdisk_store() local
299 if (!cdev) in ramdisk_store()
302 mutex_lock(&cdev->cosm_mutex); in ramdisk_store()
303 kfree(cdev->ramdisk); in ramdisk_store()
305 cdev->ramdisk = kmalloc(count + 1, GFP_KERNEL); in ramdisk_store()
306 if (!cdev->ramdisk) { in ramdisk_store()
311 strncpy(cdev->ramdisk, buf, count); in ramdisk_store()
313 if (cdev->ramdisk[count - 1] == '\n') in ramdisk_store()
314 cdev->ramdisk[count - 1] = '\0'; in ramdisk_store()
316 cdev->ramdisk[count] = '\0'; in ramdisk_store()
318 mutex_unlock(&cdev->cosm_mutex); in ramdisk_store()
326 struct cosm_device *cdev = dev_get_drvdata(dev); in bootmode_show() local
329 if (!cdev) in bootmode_show()
332 bootmode = cdev->bootmode; in bootmode_show()
343 struct cosm_device *cdev = dev_get_drvdata(dev); in bootmode_store() local
345 if (!cdev) in bootmode_store()
351 mutex_lock(&cdev->cosm_mutex); in bootmode_store()
352 kfree(cdev->bootmode); in bootmode_store()
354 cdev->bootmode = kmalloc(count + 1, GFP_KERNEL); in bootmode_store()
355 if (!cdev->bootmode) { in bootmode_store()
360 strncpy(cdev->bootmode, buf, count); in bootmode_store()
362 if (cdev->bootmode[count - 1] == '\n') in bootmode_store()
363 cdev->bootmode[count - 1] = '\0'; in bootmode_store()
365 cdev->bootmode[count] = '\0'; in bootmode_store()
367 mutex_unlock(&cdev->cosm_mutex); in bootmode_store()
376 struct cosm_device *cdev = dev_get_drvdata(dev); in log_buf_addr_show() local
378 if (!cdev) in log_buf_addr_show()
381 return scnprintf(buf, PAGE_SIZE, "%p\n", cdev->log_buf_addr); in log_buf_addr_show()
388 struct cosm_device *cdev = dev_get_drvdata(dev); in log_buf_addr_store() local
392 if (!cdev) in log_buf_addr_store()
399 cdev->log_buf_addr = (void *)addr; in log_buf_addr_store()
410 struct cosm_device *cdev = dev_get_drvdata(dev); in log_buf_len_show() local
412 if (!cdev) in log_buf_len_show()
415 return scnprintf(buf, PAGE_SIZE, "%p\n", cdev->log_buf_len); in log_buf_len_show()
422 struct cosm_device *cdev = dev_get_drvdata(dev); in log_buf_len_store() local
426 if (!cdev) in log_buf_len_store()
433 cdev->log_buf_len = (int *)addr; in log_buf_len_store()
458 void cosm_sysfs_init(struct cosm_device *cdev) in cosm_sysfs_init() argument
460 cdev->attr_group = cosm_default_groups; in cosm_sysfs_init()