1. 程式人生 > >Linux核心使用的字串轉整形函式kstrtouint

Linux核心使用的字串轉整形函式kstrtouint



kstrtouint函式定義在檔案kstrtox.c中,原形如下:

int kstrtouint(const char *s, unsigned int base, unsigned int *res)

s是輸入字串,base可以是10(10進位制)或16(16進位制),或者是0自動識別,res存放轉換後的整形值.

當沒有錯誤時返回值是0;

devm_ioremap_resource

of_property_read_u32(pdev->dev.of_node,"reg-no",&regNo);