/* "write" request on "impulse_period" special file. */ static ssize_t pcm_set_impulse_period(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { dev2pcm(dev)->impulse_period = simple_strtoul(buf, NULL, 10); return count; }
/* "write" request on "impulse_period" special file. */ static ssize_t pcm_set_impulse_period(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int value; int ret; ret = kstrtoint(buf, 10, &value); if (ret < 0) return ret; dev2pcm(dev)->impulse_period = value; return count; }
/* "write" request on "impulse_volume" special file. */ static ssize_t pcm_set_impulse_volume(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct snd_line6_pcm *line6pcm = dev2pcm(dev); int value = simple_strtoul(buf, NULL, 10); line6pcm->impulse_volume = value; if (value > 0) line6_pcm_start(line6pcm, MASK_PCM_IMPULSE); else line6_pcm_stop(line6pcm, MASK_PCM_IMPULSE); return count; }
/* "write" request on "impulse_volume" special file. */ static ssize_t pcm_set_impulse_volume(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct snd_line6_pcm *line6pcm = dev2pcm(dev); int value; int ret; ret = kstrtoint(buf, 10, &value); if (ret < 0) return ret; line6pcm->impulse_volume = value; if (value > 0) line6_pcm_acquire(line6pcm, LINE6_BITS_PCM_IMPULSE); else line6_pcm_release(line6pcm, LINE6_BITS_PCM_IMPULSE); return count; }
/* "read" request on "impulse_period" special file. */ static ssize_t pcm_get_impulse_period(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", dev2pcm(dev)->impulse_period); }
/* "read" request on "impulse_volume" special file. */ static ssize_t impulse_volume_show(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", dev2pcm(dev)->impulse_volume); }