page 65:
/* some where */
spinlock_t my_spinlock;
spin_lock_init(my_spinlock);
static irqreturn_t my_irq_handler(int irq, void *data)
{
unsigned long status, flags;
spin_lock_irqsave(&my_spinlock, flags);
status = access_shared_resources();
spin_unlock_irqrestore(&gpio->slock, flags); // wut? &
my_spinlock
return IRQ_HANDLED;
}
page 103-104:
struct my_data {
int my_int_var;
struct tasklet_struct the_tasklet;
int dma_request;
};
static irqreturn_t my_irq_handler(int irq, void *dev_id)
{
struct my_data *md = dev_id;
/* Let's schedule our tasklet */
tasklet_schedule(&md.dma_tasklet); // wut? &md->
the_tasklet
return IRQ_HANDLED;
}
page 127:
/* Move the cursor ten time, relative from the beginning of the file */
if (lseek(fd, 7, SEEK_SET) < 0)
return 1;
An so on. Seems that code samples looks like Frankenstein ripped from some random kernel places
Комментариев нет:
Отправить комментарий