Hi all, and thanks for helping.
The situation:
I have one module (ad7877), that creates entries under /sys, which I need to access using another module.
It's a simple gpio I need to toogle, but how do I do that?
I know that I can't access the filesystem (and why it's a bad idea), so instead I want to use a function in the first module to set the gpio value.
I know that I can export the function via export_symbol(...), but how do I pass arguments between the two (and how do I get the right ones)?
The function in the first module is:
Code:
static ssize_t ad7877_gpio1_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct ad7877 *ts = dev_get_drvdata(dev);
char *endp;
int i;
i = simple_strtoul(buf, &endp, 10);
if (i) {
ts->gpio1=1;
} else {
ts->gpio1=0;
}
ad7877_write(dev, AD7877_REG_EXTWRITE, AD7877_EXTW_GPIO_DATA | (ts->gpio3 << 5) | (ts->gpio2 << 6)| (ts->gpio1 << 7));
return count;
}
where the "dev" and "attr" parameters are specific for the ad7877 device driver instance.
Since my system only has one ad7877 (touchscreen controller), I guess I could just export the dev and attr as well, but that doesn't seem like a good solution.
How is this best done?