/* Return value: A pointer to a &struct hpsb_packet or NULL on allocation failure.  */
struct hpsb_packet* hpsb_alloc_packet(size_t data_size)
/* Return value: A pointer to a &struct hpsb_packet or NULL on allocation failure.  */
struct hpsb_packet* hpsb_alloc_packet(size_t data_size)
{
	struct hpsb_packet *packet;
	data_size = ((data_size + 3) & ~3);
	packet = kzalloc(sizeof(*packet) + data_size, GFP_ATOMIC);
	if (!packet)
		return NULL;
	packet->state = hpsb_unused;
	packet->generation = -1;
	INIT_LIST_HEAD(&packet->driver_list);
	INIT_LIST_HEAD(&packet->queue);
	atomic_set(&packet->refcnt, 1);
	if (data_size) {
		packet->data = packet->embedded_data;
		packet->allocated_data_size = data_size;
	}
	return packet;
}