From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
To: "Ji-Ze Hong (Peter Hong)" <hpeter@gmail.com>
Cc: johan@kernel.org, gregkh@linuxfoundation.org,
tom_tsai@fintek.com.tw, peter_hong@fintek.com.tw,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
"Ji-Ze Hong (Peter Hong)" <hpeter+linux_kernel@gmail.com>
Subject: Re: [PATCH] usb:serial: Add Fintek F81532/534 driver
Date: Fri, 29 Jul 2016 13:48:02 +0100 [thread overview]
Message-ID: <20160729134802.3bdbfe84@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <1464658417-2689-1-git-send-email-hpeter+linux_kernel@gmail.com>
O
> +static int f81534_set_normal_register(struct usb_device *dev, u16 reg, u8 data)
> +{
> + size_t count = F81534_USB_MAX_RETRY;
> + int status;
> + u8 *tmp;
> +
> + tmp = kmalloc(sizeof(u8), GFP_KERNEL);
> + if (!tmp)
> + return -ENOMEM;
You end up doing huge numbers of tiny allocation and frees in some of the
code paths. I think it would be better to allocate them at a higher level
as they are not that cheap on CPU time.
> +static int f81534_read_data(struct usb_serial *usbserial, u32 address,
> + size_t size, unsigned char *buf)
> +{
Is a particularly good example - you do 4 mallocs plus two per byte of
data.
Alan
next prev parent reply other threads:[~2016-07-29 12:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 1:33 Ji-Ze Hong (Peter Hong)
2016-05-31 1:49 ` Peter Hung
2016-07-29 12:48 ` One Thousand Gnomes [this message]
2016-08-04 6:25 ` Ji-Ze Hong (Peter Hong)
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=20160729134802.3bdbfe84@lxorguk.ukuu.org.uk \
--to=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=hpeter+linux_kernel@gmail.com \
--cc=hpeter@gmail.com \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter_hong@fintek.com.tw \
--cc=tom_tsai@fintek.com.tw \
/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
all inboxes | Powered by JetHome®