* [RFC] ptp: Delete invalided timestamp event queue code
@ 2024-10-07 15:25 tao
2024-10-09 7:06 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: tao @ 2024-10-07 15:25 UTC (permalink / raw)
To: richardcochran; +Cc: netdev, tao
used timestamp event queue In ptp_open func, queue of ptp_clock_register
already invalid so delete it
Signed-off-by: tao <wangtaowt166@163.com>
---
drivers/ptp/ptp_clock.c | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index c56cd0f63909..9be8136cb64c 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -235,7 +235,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
struct device *parent)
{
struct ptp_clock *ptp;
- struct timestamp_event_queue *queue = NULL;
int err, index, major = MAJOR(ptp_devt);
char debugfsname[16];
size_t size;
@@ -260,20 +259,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
ptp->devid = MKDEV(major, index);
ptp->index = index;
INIT_LIST_HEAD(&ptp->tsevqs);
- queue = kzalloc(sizeof(*queue), GFP_KERNEL);
- if (!queue) {
- err = -ENOMEM;
- goto no_memory_queue;
- }
- list_add_tail(&queue->qlist, &ptp->tsevqs);
spin_lock_init(&ptp->tsevqs_lock);
- queue->mask = bitmap_alloc(PTP_MAX_CHANNELS, GFP_KERNEL);
- if (!queue->mask) {
- err = -ENOMEM;
- goto no_memory_bitmap;
- }
- bitmap_set(queue->mask, 0, PTP_MAX_CHANNELS);
- spin_lock_init(&queue->lock);
mutex_init(&ptp->pincfg_mux);
mutex_init(&ptp->n_vclocks_mux);
init_waitqueue_head(&ptp->tsev_wq);
@@ -380,11 +366,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
kworker_err:
mutex_destroy(&ptp->pincfg_mux);
mutex_destroy(&ptp->n_vclocks_mux);
- bitmap_free(queue->mask);
-no_memory_bitmap:
- list_del(&queue->qlist);
- kfree(queue);
-no_memory_queue:
xa_erase(&ptp_clocks_map, index);
no_slot:
kfree(ptp);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC] ptp: Delete invalided timestamp event queue code
2024-10-07 15:25 [RFC] ptp: Delete invalided timestamp event queue code tao
@ 2024-10-09 7:06 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2024-10-09 7:06 UTC (permalink / raw)
To: tao; +Cc: richardcochran, netdev
On Mon, Oct 07, 2024 at 11:25:02PM +0800, tao wrote:
> used timestamp event queue In ptp_open func, queue of ptp_clock_register
> already invalid so delete it
>
> Signed-off-by: tao <wangtaowt166@163.com>
> ---
> drivers/ptp/ptp_clock.c | 19 -------------------
> 1 file changed, 19 deletions(-)
>
> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> index c56cd0f63909..9be8136cb64c 100644
> --- a/drivers/ptp/ptp_clock.c
> +++ b/drivers/ptp/ptp_clock.c
> @@ -235,7 +235,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
> struct device *parent)
> {
> struct ptp_clock *ptp;
> - struct timestamp_event_queue *queue = NULL;
> int err, index, major = MAJOR(ptp_devt);
> char debugfsname[16];
> size_t size;
> @@ -260,20 +259,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
> ptp->devid = MKDEV(major, index);
> ptp->index = index;
> INIT_LIST_HEAD(&ptp->tsevqs);
> - queue = kzalloc(sizeof(*queue), GFP_KERNEL);
> - if (!queue) {
> - err = -ENOMEM;
> - goto no_memory_queue;
> - }
> - list_add_tail(&queue->qlist, &ptp->tsevqs);
Here the queue is connected to ptp->tseqvs,
as was the case when it was added in
d26ab5a35ad9 ("ptp: Replace timestamp event queue with linked list")
Are you saying that it is no longer used as per that commit?
> spin_lock_init(&ptp->tsevqs_lock);
> - queue->mask = bitmap_alloc(PTP_MAX_CHANNELS, GFP_KERNEL);
> - if (!queue->mask) {
> - err = -ENOMEM;
> - goto no_memory_bitmap;
> - }
> - bitmap_set(queue->mask, 0, PTP_MAX_CHANNELS);
> - spin_lock_init(&queue->lock);
> mutex_init(&ptp->pincfg_mux);
> mutex_init(&ptp->n_vclocks_mux);
> init_waitqueue_head(&ptp->tsev_wq);
> @@ -380,11 +366,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
> kworker_err:
> mutex_destroy(&ptp->pincfg_mux);
> mutex_destroy(&ptp->n_vclocks_mux);
> - bitmap_free(queue->mask);
> -no_memory_bitmap:
> - list_del(&queue->qlist);
> - kfree(queue);
> -no_memory_queue:
> xa_erase(&ptp_clocks_map, index);
> no_slot:
> kfree(ptp);
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-09 7:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 15:25 [RFC] ptp: Delete invalided timestamp event queue code tao
2024-10-09 7:06 ` Simon Horman
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).