/* Note: caller must ensure exclusive access to device  */
static int make_magnitude_modifier(struct iforce *iforce, struct resource *mod_chunk, int no_alloc, __s16 level)
/* Note: caller must ensure exclusive access to device  */
static int make_magnitude_modifier(struct iforce *iforce, struct resource *mod_chunk, int no_alloc, __s16 level)
{
	unsigned char data[3];
	if (!no_alloc) {
		mutex_lock(&iforce->mem_mutex);
		if (allocate_resource(&(iforce->device_memory), mod_chunk, 2,
			iforce->device_memory.start, iforce->device_memory.end, 2L,
			NULL, NULL)) {
			mutex_unlock(&iforce->mem_mutex);
			return -ENOSPC;
		}
		mutex_unlock(&iforce->mem_mutex);
	}
	data[0] = LO(mod_chunk->start);
	data[1] = HI(mod_chunk->start);
	data[2] = HIFIX80(level);
	iforce_send_packet(iforce, FF_CMD_MAGNITUDE, data);
	iforce_dump_packet("magnitude: ", FF_CMD_MAGNITUDE, data);
	return 0;
}