Re: [PATCH 5/8] staging: nvec: rewrite of the ISR and data handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2011-08-24 at 20:23 +0200, Marc Dietrich wrote:
> This is a rather large patch. The older code wasn't stable enough
> in all cases as it confused the EC during high system load. The new
> code uses a better state machine which is quiet similar to the
> original code from NVIDIA.
[]
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
[]
> @@ -91,29 +91,73 @@ static int nvec_status_notifier(struct notifier_block *nb,
>  void nvec_write_async(struct nvec_chip *nvec, const unsigned char *data,
>  			short size)
>  {
> -	struct nvec_msg *msg = kzalloc(sizeof(struct nvec_msg), GFP_NOWAIT);
> +	struct nvec_msg *msg;
> +	unsigned long flags;
>  
> -	msg->data = kzalloc(size, GFP_NOWAIT);
> +	msg = kzalloc(sizeof(struct nvec_msg), GFP_ATOMIC);
>  	msg->data[0] = size;
>  	memcpy(msg->data + 1, data, size);
>  	msg->size = size + 1;
> -	msg->pos = 0;
> -	INIT_LIST_HEAD(&msg->node);
>  
> +	spin_lock_irqsave(&nvec->tx_lock, flags);
>  	list_add_tail(&msg->node, &nvec->tx_data);
> +	spin_unlock_irqrestore(&nvec->tx_lock, flags);

> diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h
[]
>  struct nvec_msg {
> -	unsigned char *data;
> +	struct list_head node;
> +	unsigned char data[MAX_PKT_SIZE];
>  	unsigned short size;
>  	unsigned short pos;
> -	struct list_head node;
> +	unsigned short used;
>  };

Looks like this kzalloc should be kmalloc
and the other fields should be initialized
instead.

It might be better to have a preallocated
ring of nvec_msg buffers so there isn't
a need to use GFP_ATOMIC.


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux