Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee801c5d authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mhi: core: use kmemdup rather than duplicating it's implementation"

parents d7af76f8 e54b71eb
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -394,7 +394,7 @@ int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl,

		/* last entry is for vector table */
		if (i == segments - 1)
			vec_size = sizeof(struct __packed bhi_vec_entry) * i;
			vec_size = sizeof(struct bhi_vec_entry) * i;

		mhi_buf->len = vec_size;
		mhi_buf->buf = mhi_alloc_coherent(mhi_cntrl, vec_size,
@@ -506,7 +506,7 @@ void mhi_fw_load_worker(struct work_struct *work)
	if (size > firmware->size)
		size = firmware->size;

	buf = kmalloc(size, GFP_KERNEL);
	buf = kmemdup(firmware->data, size, GFP_KERNEL);
	if (!buf) {
		MHI_ERR("Could not allocate memory for image\n");
		release_firmware(firmware);
@@ -514,7 +514,6 @@ void mhi_fw_load_worker(struct work_struct *work)
	}

	/* load sbl image */
	memcpy(buf, firmware->data, size);
	ret = mhi_fw_load_sbl(mhi_cntrl, buf, size);
	kfree(buf);

+1 −1
Original line number Diff line number Diff line
@@ -212,7 +212,7 @@ static int mhi_dtr_probe(struct mhi_device *mhi_dev,

static const struct mhi_device_id mhi_dtr_table[] = {
	{ .chan = "IP_CTRL" },
	{ NULL },
	{},
};

static struct mhi_driver mhi_dtr_driver = {
+4 −12
Original line number Diff line number Diff line
@@ -333,7 +333,7 @@ int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl)
		er_ctxt->msivec = mhi_event->msi;
		mhi_event->db_cfg.db_mode = true;

		ring->el_size = sizeof(struct __packed mhi_tre);
		ring->el_size = sizeof(struct mhi_tre);
		ring->len = ring->el_size * ring->elements;
		ret = mhi_alloc_aligned_ring(mhi_cntrl, ring, ring->len);
		if (ret)
@@ -358,7 +358,7 @@ int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl)
	for (i = 0; i < NR_OF_CMD_RINGS; i++, mhi_cmd++, cmd_ctxt++) {
		struct mhi_ring *ring = &mhi_cmd->ring;

		ring->el_size = sizeof(struct __packed mhi_tre);
		ring->el_size = sizeof(struct mhi_tre);
		ring->elements = CMD_EL_PER_RING;
		ring->len = ring->el_size * ring->elements;
		ret = mhi_alloc_aligned_ring(mhi_cntrl, ring, ring->len);
@@ -643,7 +643,7 @@ int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl,

	buf_ring = &mhi_chan->buf_ring;
	tre_ring = &mhi_chan->tre_ring;
	tre_ring->el_size = sizeof(struct __packed mhi_tre);
	tre_ring->el_size = sizeof(struct mhi_tre);
	tre_ring->len = tre_ring->el_size * tre_ring->elements;
	chan_ctxt = &mhi_cntrl->mhi_ctxt->chan_ctxt[mhi_chan->chan];
	ret = mhi_alloc_aligned_ring(mhi_cntrl, tre_ring, tre_ring->len);
@@ -736,7 +736,6 @@ int mhi_device_configure(struct mhi_device *mhi_dev,
	return 0;
}

#if defined(CONFIG_OF)
static int of_parse_ev_cfg(struct mhi_controller *mhi_cntrl,
			   struct device_node *of_node)
{
@@ -1046,13 +1045,6 @@ static int of_parse_dt(struct mhi_controller *mhi_cntrl,

	return ret;
}
#else
static int of_parse_dt(struct mhi_controller *mhi_cntrl,
		       struct device_node *of_node)
{
	return -EINVAL;
}
#endif

int of_register_mhi_controller(struct mhi_controller *mhi_cntrl)
{
@@ -1291,7 +1283,7 @@ static int mhi_match(struct device *dev, struct device_driver *drv)
	if (mhi_dev->dev_type == MHI_CONTROLLER_TYPE)
		return 0;

	for (id = mhi_drv->id_table; id->chan; id++)
	for (id = mhi_drv->id_table; id->chan[0]; id++)
		if (!strcmp(mhi_dev->chan_name, id->chan)) {
			mhi_dev->id = id;
			return 1;
+17 −17
Original line number Diff line number Diff line
@@ -220,47 +220,47 @@ extern struct bus_type mhi_bus_type;
#define BHIE_RXVECSTATUS_STATUS_XFER_COMPL (0x02)
#define BHIE_RXVECSTATUS_STATUS_ERROR (0x03)

struct __packed mhi_event_ctxt {
struct mhi_event_ctxt {
	u32 reserved : 8;
	u32 intmodc : 8;
	u32 intmodt : 16;
	u32 ertype;
	u32 msivec;
	u64 rbase;
	u64 rlen;
	u64 rp;
	u64 wp;
	u64 rbase __packed __aligned(4);
	u64 rlen __packed __aligned(4);
	u64 rp __packed __aligned(4);
	u64 wp __packed __aligned(4);
};

struct __packed mhi_chan_ctxt {
struct mhi_chan_ctxt {
	u32 chstate : 8;
	u32 brstmode : 2;
	u32 pollcfg : 6;
	u32 reserved : 16;
	u32 chtype;
	u32 erindex;
	u64 rbase;
	u64 rlen;
	u64 rp;
	u64 wp;
	u64 rbase __packed __aligned(4);
	u64 rlen __packed __aligned(4);
	u64 rp __packed __aligned(4);
	u64 wp __packed __aligned(4);
};

struct __packed mhi_cmd_ctxt {
struct mhi_cmd_ctxt {
	u32 reserved0;
	u32 reserved1;
	u32 reserved2;
	u64 rbase;
	u64 rlen;
	u64 rp;
	u64 wp;
	u64 rbase __packed __aligned(4);
	u64 rlen __packed __aligned(4);
	u64 rp __packed __aligned(4);
	u64 wp __packed __aligned(4);
};

struct __packed mhi_tre {
struct mhi_tre {
	u64 ptr;
	u32 dword[2];
};

struct __packed bhi_vec_entry {
struct bhi_vec_entry {
	u64 dma_addr;
	u64 size;
};
+1 −1
Original line number Diff line number Diff line
@@ -977,7 +977,7 @@ static int mhi_netdev_probe(struct mhi_device *mhi_dev,
static const struct mhi_device_id mhi_netdev_match_table[] = {
	{ .chan = "IP_HW0" },
	{ .chan = "IP_HW_ADPL" },
	{ NULL },
	{},
};

static struct mhi_driver mhi_netdev_driver = {
Loading