From: Andrew Lunn <andrew@lunn.ch>
To: Igor Russkikh <Igor.Russkikh@aquantia.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"richardcochran@gmail.com" <richardcochran@gmail.com>,
"davem@davemloft.net" <davem@davemloft.net>,
Egor Pomozov <Egor.Pomozov@aquantia.com>,
Sergey Samoilenko <Sergey.Samoilenko@aquantia.com>,
Dmitry Bezrukov <Dmitry.Bezrukov@aquantia.com>
Subject: Re: [PATCH net-next 01/11] net: aquantia: PTP skeleton declarations and callbacks
Date: Tue, 10 Sep 2019 21:10:29 +0200 [thread overview]
Message-ID: <20190910191029.GE9761@lunn.ch> (raw)
In-Reply-To: <cf60b1d3d797d0666a4828fcf5e521e0bd73f8d4.1568034880.git.igor.russkikh@aquantia.com>
On Mon, Sep 09, 2019 at 01:38:38PM +0000, Igor Russkikh wrote:
> From: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Hi Igor, et al.
> @@ -331,6 +332,10 @@ int aq_nic_init(struct aq_nic_s *self)
> self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i])
> aq_vec_init(aq_vec, self->aq_hw_ops, self->aq_hw);
> +int aq_ptp_init(struct aq_nic_s *aq_nic, unsigned int idx_vec)
> +{
> + struct hw_atl_utils_mbox mbox;
> + struct ptp_clock *clock;
> + struct aq_ptp_s *self;
I find the use of self in this code quite confusing. It does not
appear to have a clear meaning. It can be a aq_ring_s, aq_nic_c,
aq_hw_s, aq_vec_s.
Looking at this code i always have to figure out what self is. Could
you not just use struct aq_ptp_s aq_ptp consistently in the code?
> + int err = 0;
> +
> + hw_atl_utils_mpi_read_stats(aq_nic->aq_hw, &mbox);
> +
> + if (!(mbox.info.caps_ex & BIT(CAPS_EX_PHY_PTP_EN))) {
> + aq_nic->aq_ptp = NULL;
> + return 0;
> + }
> +
> + self = kzalloc(sizeof(*self), GFP_KERNEL);
Using devm_kzalloc() will make your clean up easier.
> +void aq_ptp_free(struct aq_nic_s *aq_nic)
> +{
> + struct aq_ptp_s *self = aq_nic->aq_ptp;
> +
> + if (!self)
> + return;
> +
> + kfree(self);
kfree() is happy to take a NULL pointer. But this could all go away
with devm_kzalloc().
Andrew
next prev parent reply other threads:[~2019-09-10 19:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-09 13:38 [PATCH net-next 00/11] net: aquantia: PTP support for AQC devices Igor Russkikh
2019-09-09 13:38 ` [PATCH net-next 01/11] net: aquantia: PTP skeleton declarations and callbacks Igor Russkikh
2019-09-10 19:10 ` Andrew Lunn [this message]
2019-09-11 11:41 ` Igor Russkikh
2019-09-09 13:38 ` [PATCH net-next 02/11] net: aquantia: unify styling of bit enums Igor Russkikh
2019-09-09 13:38 ` [PATCH net-next 03/11] net: aquantia: add basic ptp_clock callbacks Igor Russkikh
2019-09-09 23:27 ` kbuild test robot
2019-09-10 2:45 ` kbuild test robot
2019-09-10 19:20 ` Andrew Lunn
2019-09-09 13:38 ` [PATCH net-next 04/11] net: aquantia: add PTP rings infrastructure Igor Russkikh
2019-09-09 13:38 ` [PATCH net-next 05/11] net: aquantia: styling fixes on ptp related functions Igor Russkikh
2019-09-09 13:38 ` [PATCH net-next 06/11] net: aquantia: implement data PTP datapath Igor Russkikh
2019-09-09 13:38 ` [PATCH net-next 07/11] net: aquantia: rx filters for ptp Igor Russkikh
2019-09-09 13:38 ` [PATCH net-next 08/11] net: aquantia: add support for ptp ioctls Igor Russkikh
2019-09-09 13:38 ` [PATCH net-next 09/11] net: aquantia: implement get_ts_info ethtool Igor Russkikh
2019-09-09 13:38 ` [PATCH net-next 10/11] net: aquantia: add support for Phy access Igor Russkikh
2019-09-09 13:39 ` [PATCH net-next 11/11] net: aquantia: add support for PIN funcs Igor Russkikh
2019-09-10 2:45 ` kbuild test robot
2019-09-10 13:03 ` kbuild test robot
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=20190910191029.GE9761@lunn.ch \
--to=andrew@lunn.ch \
--cc=Dmitry.Bezrukov@aquantia.com \
--cc=Egor.Pomozov@aquantia.com \
--cc=Igor.Russkikh@aquantia.com \
--cc=Sergey.Samoilenko@aquantia.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/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).