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

Commit 6dfe8d81 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Make the a6xx mbox client static



There isn't any need to allocate dynamic memory for the mailbox client.

Change-Id: Ic0dedbad5ecd1b0e5702d2731b1b834418e3399c
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent e2d7f1c1
Loading
Loading
Loading
Loading
+13 −35
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@
#include <linux/firmware.h>
#include <linux/io.h>
#include <linux/iommu.h>
#include <linux/mailbox_client.h>
#include <linux/msm-bus.h>
#include <linux/of_platform.h>
#include <linux/regulator/consumer.h>
@@ -1053,7 +1052,7 @@ static void gmu_aop_send_acd_state(struct kgsl_device *device, bool flag)
	char msg_buf[33];
	int ret;

	if (!gmu->mailbox.client)
	if (IS_ERR_OR_NULL(gmu->mailbox.channel))
		return;

	msg.len = scnprintf(msg_buf, sizeof(msg_buf),
@@ -1066,45 +1065,20 @@ static void gmu_aop_send_acd_state(struct kgsl_device *device, bool flag)
				"AOP mbox send message failed: %d\n", ret);
}

static void gmu_aop_mailbox_destroy(struct kgsl_device *device)
{
	struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
	struct gmu_device *gmu = KGSL_GMU_DEVICE(device);
	struct kgsl_mailbox *mailbox = &gmu->mailbox;

	if (!mailbox->client)
		return;

	mbox_free_channel(mailbox->channel);
	mailbox->channel = NULL;

	kfree(mailbox->client);
	mailbox->client = NULL;

	clear_bit(ADRENO_ACD_CTRL, &adreno_dev->pwrctrl_flag);
}

static int gmu_aop_mailbox_init(struct kgsl_device *device,
		struct gmu_device *gmu)
{
	struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
	struct kgsl_mailbox *mailbox = &gmu->mailbox;

	mailbox->client = kzalloc(sizeof(*mailbox->client), GFP_KERNEL);
	if (!mailbox->client)
		return -ENOMEM;

	mailbox->client->dev = &gmu->pdev->dev;
	mailbox->client->tx_block = true;
	mailbox->client->tx_tout = 1000;
	mailbox->client->knows_txdone = false;
	mailbox->client.dev = &gmu->pdev->dev;
	mailbox->client.tx_block = true;
	mailbox->client.tx_tout = 1000;
	mailbox->client.knows_txdone = false;

	mailbox->channel = mbox_request_channel(mailbox->client, 0);
	if (IS_ERR(mailbox->channel)) {
		kfree(mailbox->client);
		mailbox->client = NULL;
	mailbox->channel = mbox_request_channel(&mailbox->client, 0);
	if (IS_ERR(mailbox->channel))
		return PTR_ERR(mailbox->channel);
	}

	set_bit(ADRENO_ACD_CTRL, &adreno_dev->pwrctrl_flag);
	return 0;
@@ -1115,7 +1089,7 @@ static int gmu_acd_set(struct kgsl_device *device, unsigned int val)
	struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
	struct gmu_device *gmu = KGSL_GMU_DEVICE(device);

	if (!gmu->mailbox.client)
	if (IS_ERR_OR_NULL(gmu->mailbox.channel))
		return -EINVAL;

	/* Don't do any unneeded work if ACD is already in the correct state */
@@ -1641,6 +1615,7 @@ static void gmu_stop(struct kgsl_device *device)

static void gmu_remove(struct kgsl_device *device)
{
	struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
	struct gmu_device *gmu = KGSL_GMU_DEVICE(device);
	struct kgsl_hfi *hfi;
	int i = 0;
@@ -1654,7 +1629,10 @@ static void gmu_remove(struct kgsl_device *device)

	gmu_stop(device);

	gmu_aop_mailbox_destroy(device);
	if (!IS_ERR_OR_NULL(gmu->mailbox.channel))
		mbox_free_channel(gmu->mailbox.channel);

	clear_bit(ADRENO_ACD_CTRL, &adreno_dev->pwrctrl_flag);

	while ((i < MAX_GMU_CLKS) && gmu->clks[i]) {
		gmu->clks[i] = NULL;
+3 −1
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@
#ifndef __KGSL_GMU_H
#define __KGSL_GMU_H

#include <linux/mailbox_client.h>

#include "kgsl_gmu_core.h"
#include "kgsl_hfi.h"

@@ -139,7 +141,7 @@ enum gmu_load_mode {
};

struct kgsl_mailbox {
	struct mbox_client *client;
	struct mbox_client client;
	struct mbox_chan *channel;
};