From: Greg KH <gregkh@linuxfoundation.org>
To: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
Cc: sean@mess.org, linux-kernel@vger.kernel.org, tglx@linutronix.de,
mchehab@kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org,
linux-media@vger.kernel.org
Subject: Re: [Linux-kernel-mentees] [PATCH 1/1] media: dvb_dummy_tuner: implement driver skeleton
Date: Thu, 9 Jan 2020 16:54:37 +0100 [thread overview]
Message-ID: <20200109155437.GA568342@kroah.com> (raw)
In-Reply-To: <20200109152408.919325-2-dwlsalmeida@gmail.com>
On Thu, Jan 09, 2020 at 12:24:08PM -0300, Daniel W. S. Almeida wrote:
> +static int dvb_dummy_tuner_i2c_probe(struct i2c_client *client,
> + const struct i2c_device_id *id)
> +{
> + int ret = 0;
> + struct dvb_dummy_tuner_config *config = client->dev.platform_data;
> + struct dvb_frontend *fe = config->fe;
> + struct dvb_dummy_tuner_dev *tuner_dev = NULL;
> +
> + tuner_dev = kzalloc(sizeof(*tuner_dev), GFP_KERNEL);
> + if (!tuner_dev) {
> + ret = -ENOMEM;
> + goto err;
> + }
> +
> + i2c_set_clientdata(client, tuner_dev);
> + tuner_dev->fe = config->fe;
> +
> + memcpy(&fe->ops.tuner_ops,
> + &dvb_dummy_tuner_ops,
> + sizeof(struct dvb_tuner_ops));
> +
> + fe->tuner_priv = client;
> +
> + pr_debug("%s: Successfully probed %s\n", __func__, client->name);
As you are a driver, you should never need to call any pr_* calls,
instead use dev_*(). For this, you can use dev_dbg(), but really, why
is that even needed except for your debugging bringup. And for that,
you can use ftrace, right? So no need for any printing of anything
here.
> + return ret;
> +
> +err:
> + pr_err("%s: failed\n", __func__);
Again, dev_err() would be proper, but there's no need for any error
message here.
Don't you need to register the tuner ops with something in this
function?
> + return ret;
> +}
> +
> +static int dvb_dummy_tuner_i2c_remove(struct i2c_client *client)
> +{
> + struct dvb_dummy_tuner_dev *tuner_dev = i2c_get_clientdata(client);
> + struct dvb_frontend *fe = tuner_dev->fe;
> +
> + memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops));
> + fe->tuner_priv = NULL;
> + kfree(tuner_dev);
> +
Don't you need to unregister the tuner ops in here?
thanks,
greg k-h
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2020-01-09 15:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-09 15:24 [Linux-kernel-mentees] [PATCH 0/1] Implement a DVB Dummy Tuner Daniel W. S. Almeida
2020-01-09 15:24 ` [Linux-kernel-mentees] [PATCH 1/1] media: dvb_dummy_tuner: implement driver skeleton Daniel W. S. Almeida
2020-01-09 15:54 ` Greg KH [this message]
2020-01-09 20:43 ` Daniel W. S. Almeida
2020-01-09 16:13 ` Mauro Carvalho Chehab
2020-01-09 20:52 ` Daniel W. S. Almeida
2020-01-09 16:45 ` Shuah Khan
2020-01-09 21:00 ` Daniel W. S. Almeida
2020-01-09 21:11 ` Shuah Khan
2020-01-09 16:07 ` [Linux-kernel-mentees] [PATCH 0/1] Implement a DVB Dummy Tuner Mauro Carvalho Chehab
2020-01-09 20:51 ` Daniel W. S. Almeida
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200109155437.GA568342@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=dwlsalmeida@gmail.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sean@mess.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).