hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/media/pci/tw68/tw68-core.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * tw68-core.c
34 * Core functions for the Techwell 68xx driver
....@@ -14,16 +15,6 @@
1415 * Refactored and updated to the latest v4l core frameworks:
1516 *
1617 * Copyright (C) 2014 Hans Verkuil <hverkuil@xs4all.nl>
17
- *
18
- * This program is free software; you can redistribute it and/or modify
19
- * it under the terms of the GNU General Public License as published by
20
- * the Free Software Foundation; either version 2 of the License, or
21
- * (at your option) any later version.
22
- *
23
- * This program is distributed in the hope that it will be useful,
24
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- * GNU General Public License for more details.
2718 */
2819
2920 #include <linux/init.h>
....@@ -66,7 +57,7 @@
6657 /* ------------------------------------------------------------------ */
6758
6859 /*
69
- * Please add any new PCI IDs to: http://pci-ids.ucw.cz. This keeps
60
+ * Please add any new PCI IDs to: https://pci-ids.ucw.cz. This keeps
7061 * the PCI ID database up to date. Note that the entries must be
7162 * added under vendor 0x1797 (Techwell Inc.) as subsystem IDs.
7263 */
....@@ -368,10 +359,9 @@
368359 v4l2_device_unregister(&dev->v4l2_dev);
369360 }
370361
371
-#ifdef CONFIG_PM
372
-
373
-static int tw68_suspend(struct pci_dev *pci_dev , pm_message_t state)
362
+static int __maybe_unused tw68_suspend(struct device *dev_d)
374363 {
364
+ struct pci_dev *pci_dev = to_pci_dev(dev_d);
375365 struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
376366 struct tw68_dev *dev = container_of(v4l2_dev,
377367 struct tw68_dev, v4l2_dev);
....@@ -382,23 +372,18 @@
382372
383373 synchronize_irq(pci_dev->irq);
384374
385
- pci_save_state(pci_dev);
386
- pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
387375 vb2_discard_done(&dev->vidq);
388376
389377 return 0;
390378 }
391379
392
-static int tw68_resume(struct pci_dev *pci_dev)
380
+static int __maybe_unused tw68_resume(struct device *dev_d)
393381 {
394
- struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
382
+ struct v4l2_device *v4l2_dev = dev_get_drvdata(dev_d);
395383 struct tw68_dev *dev = container_of(v4l2_dev,
396384 struct tw68_dev, v4l2_dev);
397385 struct tw68_buf *buf;
398386 unsigned long flags;
399
-
400
- pci_set_power_state(pci_dev, PCI_D0);
401
- pci_restore_state(pci_dev);
402387
403388 /* Do things that are done in tw68_initdev ,
404389 except of initializing memory structures.*/
....@@ -417,19 +402,17 @@
417402
418403 return 0;
419404 }
420
-#endif
421405
422406 /* ----------------------------------------------------------- */
423407
408
+static SIMPLE_DEV_PM_OPS(tw68_pm_ops, tw68_suspend, tw68_resume);
409
+
424410 static struct pci_driver tw68_pci_driver = {
425
- .name = "tw68",
426
- .id_table = tw68_pci_tbl,
427
- .probe = tw68_initdev,
428
- .remove = tw68_finidev,
429
-#ifdef CONFIG_PM
430
- .suspend = tw68_suspend,
431
- .resume = tw68_resume
432
-#endif
411
+ .name = "tw68",
412
+ .id_table = tw68_pci_tbl,
413
+ .probe = tw68_initdev,
414
+ .remove = tw68_finidev,
415
+ .driver.pm = &tw68_pm_ops,
433416 };
434417
435418 module_pci_driver(tw68_pci_driver);