.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * |
---|
3 | | - * |
---|
4 | 4 | * Copyright (C) 2005 Mike Isely <isely@pobox.com> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, |
---|
11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | - * GNU General Public License for more details. |
---|
14 | | - * |
---|
15 | 5 | */ |
---|
16 | 6 | |
---|
17 | 7 | #include <linux/i2c.h> |
---|
.. | .. |
---|
478 | 468 | unsigned int idx,offs,cnt; |
---|
479 | 469 | for (idx = 0; idx < num; idx++) { |
---|
480 | 470 | cnt = msgs[idx].len; |
---|
481 | | - printk(KERN_INFO |
---|
482 | | - "pvrusb2 i2c xfer %u/%u: addr=0x%x len=%d %s", |
---|
| 471 | + pr_info("pvrusb2 i2c xfer %u/%u: addr=0x%x len=%d %s", |
---|
483 | 472 | idx+1,num, |
---|
484 | 473 | msgs[idx].addr, |
---|
485 | 474 | cnt, |
---|
.. | .. |
---|
487 | 476 | "read" : "write")); |
---|
488 | 477 | if ((ret > 0) || !(msgs[idx].flags & I2C_M_RD)) { |
---|
489 | 478 | if (cnt > 8) cnt = 8; |
---|
490 | | - printk(KERN_CONT " ["); |
---|
| 479 | + pr_cont(" ["); |
---|
491 | 480 | for (offs = 0; offs < cnt; offs++) { |
---|
492 | | - if (offs) printk(KERN_CONT " "); |
---|
493 | | - printk(KERN_CONT "%02x",msgs[idx].buf[offs]); |
---|
| 481 | + if (offs) pr_cont(" "); |
---|
| 482 | + pr_cont("%02x", msgs[idx].buf[offs]); |
---|
494 | 483 | } |
---|
495 | | - if (offs < cnt) printk(KERN_CONT " ..."); |
---|
496 | | - printk(KERN_CONT "]"); |
---|
| 484 | + if (offs < cnt) pr_cont(" ..."); |
---|
| 485 | + pr_cont("]"); |
---|
497 | 486 | } |
---|
498 | 487 | if (idx+1 == num) { |
---|
499 | | - printk(KERN_CONT " result=%d",ret); |
---|
| 488 | + pr_cont(" result=%d", ret); |
---|
500 | 489 | } |
---|
501 | | - printk(KERN_CONT "\n"); |
---|
| 490 | + pr_cont("\n"); |
---|
502 | 491 | } |
---|
503 | 492 | if (!num) { |
---|
504 | | - printk(KERN_INFO |
---|
505 | | - "pvrusb2 i2c xfer null transfer result=%d\n", |
---|
| 493 | + pr_info("pvrusb2 i2c xfer null transfer result=%d\n", |
---|
506 | 494 | ret); |
---|
507 | 495 | } |
---|
508 | 496 | } |
---|
.. | .. |
---|
542 | 530 | static void do_i2c_scan(struct pvr2_hdw *hdw) |
---|
543 | 531 | { |
---|
544 | 532 | int i; |
---|
545 | | - printk(KERN_INFO "%s: i2c scan beginning\n", hdw->name); |
---|
| 533 | + pr_info("%s: i2c scan beginning\n", hdw->name); |
---|
546 | 534 | for (i = 0; i < 128; i++) { |
---|
547 | 535 | if (do_i2c_probe(hdw, i)) { |
---|
548 | | - printk(KERN_INFO "%s: i2c scan: found device @ 0x%x\n", |
---|
| 536 | + pr_info("%s: i2c scan: found device @ 0x%x\n", |
---|
549 | 537 | hdw->name, i); |
---|
550 | 538 | } |
---|
551 | 539 | } |
---|
552 | | - printk(KERN_INFO "%s: i2c scan done.\n", hdw->name); |
---|
| 540 | + pr_info("%s: i2c scan done.\n", hdw->name); |
---|
553 | 541 | } |
---|
554 | 542 | |
---|
555 | 543 | static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) |
---|
.. | .. |
---|
573 | 561 | /* IR Receiver */ |
---|
574 | 562 | info.addr = 0x18; |
---|
575 | 563 | info.platform_data = init_data; |
---|
576 | | - strlcpy(info.type, "ir_video", I2C_NAME_SIZE); |
---|
| 564 | + strscpy(info.type, "ir_video", I2C_NAME_SIZE); |
---|
577 | 565 | pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.", |
---|
578 | 566 | info.type, info.addr); |
---|
579 | | - i2c_new_device(&hdw->i2c_adap, &info); |
---|
| 567 | + i2c_new_client_device(&hdw->i2c_adap, &info); |
---|
580 | 568 | break; |
---|
581 | 569 | case PVR2_IR_SCHEME_ZILOG: /* HVR-1950 style */ |
---|
582 | 570 | case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */ |
---|
.. | .. |
---|
588 | 576 | /* IR Transceiver */ |
---|
589 | 577 | info.addr = 0x71; |
---|
590 | 578 | info.platform_data = init_data; |
---|
591 | | - strlcpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE); |
---|
| 579 | + strscpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE); |
---|
592 | 580 | pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.", |
---|
593 | 581 | info.type, info.addr); |
---|
594 | | - i2c_new_device(&hdw->i2c_adap, &info); |
---|
| 582 | + i2c_new_client_device(&hdw->i2c_adap, &info); |
---|
595 | 583 | break; |
---|
596 | 584 | default: |
---|
597 | 585 | /* The device either doesn't support I2C-based IR or we |
---|
.. | .. |
---|
612 | 600 | |
---|
613 | 601 | /* However, deal with various special cases for 24xxx hardware. */ |
---|
614 | 602 | if (ir_mode[hdw->unit_number] == 0) { |
---|
615 | | - printk(KERN_INFO "%s: IR disabled\n",hdw->name); |
---|
| 603 | + pr_info("%s: IR disabled\n", hdw->name); |
---|
616 | 604 | hdw->i2c_func[0x18] = i2c_black_hole; |
---|
617 | 605 | } else if (ir_mode[hdw->unit_number] == 1) { |
---|
618 | 606 | if (hdw->ir_scheme_active == PVR2_IR_SCHEME_24XXX) { |
---|
.. | .. |
---|
631 | 619 | // Configure the adapter and set up everything else related to it. |
---|
632 | 620 | hdw->i2c_adap = pvr2_i2c_adap_template; |
---|
633 | 621 | hdw->i2c_algo = pvr2_i2c_algo_template; |
---|
634 | | - strlcpy(hdw->i2c_adap.name,hdw->name,sizeof(hdw->i2c_adap.name)); |
---|
| 622 | + strscpy(hdw->i2c_adap.name, hdw->name, sizeof(hdw->i2c_adap.name)); |
---|
635 | 623 | hdw->i2c_adap.dev.parent = &hdw->usb_dev->dev; |
---|
636 | 624 | hdw->i2c_adap.algo = &hdw->i2c_algo; |
---|
637 | 625 | hdw->i2c_adap.algo_data = hdw; |
---|