Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sof/imx/imx8.c: Replace sdev->private with sdev->pdata->hw_pdata for correct usage. #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions sound/soc/sof/imx/imx8.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static struct imx_dsp_ops dsp_ops = {

static int imx8_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg)
{
struct imx8_priv *priv = (struct imx8_priv *)sdev->private;
struct imx8_priv *priv = (struct imx8_priv *)sdev->pdata->hw_pdata;

sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data,
msg->msg_size);
Expand All @@ -141,7 +141,7 @@ static int imx8_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg)
*/
static int imx8x_run(struct snd_sof_dev *sdev)
{
struct imx8_priv *dsp_priv = (struct imx8_priv *)sdev->private;
struct imx8_priv *dsp_priv = (struct imx8_priv *)sdev->pdata->hw_pdata;
int ret;

ret = imx_sc_misc_set_control(dsp_priv->sc_ipc, IMX_SC_R_DSP,
Expand Down Expand Up @@ -181,7 +181,7 @@ static int imx8x_run(struct snd_sof_dev *sdev)

static int imx8_run(struct snd_sof_dev *sdev)
{
struct imx8_priv *dsp_priv = (struct imx8_priv *)sdev->private;
struct imx8_priv *dsp_priv = (struct imx8_priv *)sdev->pdata->hw_pdata;
int ret;

ret = imx_sc_misc_set_control(dsp_priv->sc_ipc, IMX_SC_R_DSP,
Expand Down Expand Up @@ -214,7 +214,7 @@ static int imx8_probe(struct snd_sof_dev *sdev)
if (!priv)
return -ENOMEM;

sdev->private = priv;
sdev->pdata->hw_pdata = priv;
priv->dev = sdev->dev;
priv->sdev = sdev;

Expand Down Expand Up @@ -346,7 +346,7 @@ static int imx8_probe(struct snd_sof_dev *sdev)

static int imx8_remove(struct snd_sof_dev *sdev)
{
struct imx8_priv *priv = (struct imx8_priv *)sdev->private;
struct imx8_priv *priv = (struct imx8_priv *)sdev->pdata->hw_pdata;
int i;

platform_device_unregister(priv->ipc_dev);
Expand Down Expand Up @@ -381,7 +381,7 @@ static int imx8_ipc_pcm_params(struct snd_sof_dev *sdev,

int imx8_resume(struct snd_sof_dev *sdev)
{
struct imx8_priv *priv = (struct imx8_priv *)sdev->private;
struct imx8_priv *priv = (struct imx8_priv *)sdev->pdata->hw_pdata;
int i;

for (i = 0; i < DSP_MU_CHAN_NUM; i++)
Expand All @@ -392,7 +392,7 @@ int imx8_resume(struct snd_sof_dev *sdev)

int imx8_suspend(struct snd_sof_dev *sdev)
{
struct imx8_priv *priv = (struct imx8_priv *)sdev->private;
struct imx8_priv *priv = (struct imx8_priv *)sdev->pdata->hw_pdata;
int i;

for (i = 0; i < DSP_MU_CHAN_NUM; i++)
Expand All @@ -414,7 +414,7 @@ int imx8_dsp_runtime_suspend(struct snd_sof_dev *sdev)

int imx8_dsp_resume(struct snd_sof_dev *sdev)
{
struct imx8_priv *priv = (struct imx8_priv *)sdev->private;
struct imx8_priv *priv = (struct imx8_priv *)sdev->pdata->hw_pdata;

if (priv->suspended) {
imx8_resume(sdev);
Expand All @@ -426,7 +426,7 @@ int imx8_dsp_resume(struct snd_sof_dev *sdev)

int imx8_dsp_suspend(struct snd_sof_dev *sdev)
{
struct imx8_priv *priv = (struct imx8_priv *)sdev->private;
struct imx8_priv *priv = (struct imx8_priv *)sdev->pdata->hw_pdata;

if (!priv->suspended) {
imx8_suspend(sdev);
Expand Down
18 changes: 9 additions & 9 deletions sound/soc/sof/imx/imx8m.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static struct imx_dsp_ops dsp_ops = {

static int imx8m_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg)
{
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->private;
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->pdata->hw_pdata;
Copy link
Owner

@dbaluta dbaluta Jul 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit subject should start with ASoC: SOF: imx8: For example check git log sound/soc/sof/imx/imx8.c and look how previous commits are written.

e.g your commit message should be:

ASoC: SOF: imx8: Replace sdev->private with sdev->pdata->hw_pdata

The correct way to save private data is to use sdev->pdata->hw_pdata.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IulianOlaru249 also I think it is better to squash this commits and have everything done inside one singe patch becasue basically it does the same thing.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IulianOlaru249 looks good now. Care to port this to official SOF tree:

https://github.com/thesofproject/linux/tree/topic/sof-dev

Also, to reduce the commit subject size instead of imx8/imx8m we can say 'imx'. So commit subject should be:

ASoC: SOF: imx: Replace sdev->private with sdev->pdata->hw_pdata


sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data,
msg->msg_size);
Expand All @@ -176,7 +176,7 @@ static int imx8m_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg)
*/
static int imx8m_run(struct snd_sof_dev *sdev)
{
struct imx8m_priv *dsp_priv = (struct imx8m_priv *)sdev->private;
struct imx8m_priv *dsp_priv = (struct imx8m_priv *)sdev->pdata->hw_pdata;

imx_audiomix_dsp_start(dsp_priv->audiomix);

Expand All @@ -185,7 +185,7 @@ static int imx8m_run(struct snd_sof_dev *sdev)

static int imx8m_reset(struct snd_sof_dev *sdev) {

struct imx8m_priv *dsp_priv = (struct imx8m_priv *)sdev->private;
struct imx8m_priv *dsp_priv = (struct imx8m_priv *)sdev->pdata->hw_pdata;
u32 pwrctl;

/* put DSP into reset and stall */
Expand Down Expand Up @@ -223,7 +223,7 @@ static int imx8m_probe(struct snd_sof_dev *sdev)
if (!priv)
return -ENOMEM;

sdev->private = priv;
sdev->pdata->hw_pdata = priv;
priv->dev = sdev->dev;
priv->sdev = sdev;

Expand Down Expand Up @@ -366,7 +366,7 @@ static int imx8m_probe(struct snd_sof_dev *sdev)

static int imx8m_remove(struct snd_sof_dev *sdev)
{
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->private;
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->pdata->hw_pdata;
int i;

platform_device_unregister(priv->ipc_dev);
Expand Down Expand Up @@ -410,7 +410,7 @@ static struct snd_soc_dai_driver imx8m_dai[] = {

int imx8m_resume(struct snd_sof_dev *sdev)
{
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->private;
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->pdata->hw_pdata;
int i;

for (i = 0; i < IMX8M_DSP_CLK_NUM; i++)
Expand All @@ -424,7 +424,7 @@ int imx8m_resume(struct snd_sof_dev *sdev)

int imx8m_suspend(struct snd_sof_dev *sdev)
{
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->private;
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->pdata->hw_pdata;
int i;

for (i = 0; i < DSP_MU_CHAN_NUM; i++)
Expand All @@ -448,7 +448,7 @@ static int imx8m_dsp_runtime_suspend(struct snd_sof_dev *sdev)

static int imx8m_dsp_resume(struct snd_sof_dev *sdev)
{
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->private;
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->pdata->hw_pdata;

if (priv->suspended) {
imx8m_resume(sdev);
Expand All @@ -460,7 +460,7 @@ static int imx8m_dsp_resume(struct snd_sof_dev *sdev)

static int imx8m_dsp_suspend(struct snd_sof_dev *sdev)
{
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->private;
struct imx8m_priv *priv = (struct imx8m_priv *)sdev->pdata->hw_pdata;

if (!priv->suspended) {
imx8m_suspend(sdev);
Expand Down